mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-07 04:23:41 +00:00
all: format code according to Go 1.19 rules
Go 1.19 started reformatting code in a way that makes it more obvious how it will be rendered on pkg.go.dev. It gets it almost right, but not entirely. Therefore, I had to modify some of the comments so that they are formatted correctly.
This commit is contained in:
@@ -13,10 +13,11 @@ import "internal/itoa"
|
||||
// An Errno is an unsigned number describing an error condition.
|
||||
// It implements the error interface. The zero Errno is by convention
|
||||
// a non-error, so code to convert from Errno to error should use:
|
||||
// err = nil
|
||||
// if errno != 0 {
|
||||
// err = errno
|
||||
// }
|
||||
//
|
||||
// err = nil
|
||||
// if errno != 0 {
|
||||
// err = errno
|
||||
// }
|
||||
type Errno uintptr
|
||||
|
||||
func (e Errno) Error() string {
|
||||
|
||||
@@ -22,5 +22,6 @@ func Getwd() (string, error) {
|
||||
}
|
||||
|
||||
// char *getcwd(char *buf, size_t size)
|
||||
//
|
||||
//export getcwd
|
||||
func libc_getcwd(buf *byte, size uint) *byte
|
||||
|
||||
@@ -14,25 +14,31 @@ func Getpid() int { return int(libc_getpid()) }
|
||||
func Getppid() int { return int(libc_getppid()) }
|
||||
|
||||
// uid_t getuid(void)
|
||||
//
|
||||
//export getuid
|
||||
func libc_getuid() int32
|
||||
|
||||
// gid_t getgid(void)
|
||||
//
|
||||
//export getgid
|
||||
func libc_getgid() int32
|
||||
|
||||
// uid_t geteuid(void)
|
||||
//
|
||||
//export geteuid
|
||||
func libc_geteuid() int32
|
||||
|
||||
// gid_t getegid(void)
|
||||
//
|
||||
//export getegid
|
||||
func libc_getegid() int32
|
||||
|
||||
// gid_t getpid(void)
|
||||
//
|
||||
//export getpid
|
||||
func libc_getpid() int32
|
||||
|
||||
// gid_t getppid(void)
|
||||
//
|
||||
//export getppid
|
||||
func libc_getppid() int32
|
||||
|
||||
@@ -317,86 +317,107 @@ func splitSlice(p []byte) (buf *byte, len uintptr) {
|
||||
func libc_strlen(ptr unsafe.Pointer) uintptr
|
||||
|
||||
// ssize_t write(int fd, const void *buf, size_t count)
|
||||
//
|
||||
//export write
|
||||
func libc_write(fd int32, buf *byte, count uint) int
|
||||
|
||||
// char *getenv(const char *name);
|
||||
//
|
||||
//export getenv
|
||||
func libc_getenv(name *byte) *byte
|
||||
|
||||
// int setenv(const char *name, const char *val, int replace);
|
||||
//
|
||||
//export setenv
|
||||
func libc_setenv(name *byte, val *byte, replace int32) int32
|
||||
|
||||
// int unsetenv(const char *name);
|
||||
//
|
||||
//export unsetenv
|
||||
func libc_unsetenv(name *byte) int32
|
||||
|
||||
// ssize_t read(int fd, void *buf, size_t count);
|
||||
//
|
||||
//export read
|
||||
func libc_read(fd int32, buf *byte, count uint) int
|
||||
|
||||
// ssize_t pread(int fd, void *buf, size_t count, off_t offset);
|
||||
//
|
||||
//export pread
|
||||
func libc_pread(fd int32, buf *byte, count uint, offset int64) int
|
||||
|
||||
// ssize_t lseek(int fd, off_t offset, int whence);
|
||||
//
|
||||
//export lseek
|
||||
func libc_lseek(fd int32, offset int64, whence int) int64
|
||||
|
||||
// int open(const char *pathname, int flags, mode_t mode);
|
||||
//
|
||||
//export open
|
||||
func libc_open(pathname *byte, flags int32, mode uint32) int32
|
||||
|
||||
// int close(int fd)
|
||||
//
|
||||
//export close
|
||||
func libc_close(fd int32) int32
|
||||
|
||||
// int dup(int fd)
|
||||
//
|
||||
//export dup
|
||||
func libc_dup(fd int32) int32
|
||||
|
||||
// void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
|
||||
//
|
||||
//export mmap
|
||||
func libc_mmap(addr unsafe.Pointer, length uintptr, prot, flags, fd int32, offset uintptr) unsafe.Pointer
|
||||
|
||||
// int munmap(void *addr, size_t length);
|
||||
//
|
||||
//export munmap
|
||||
func libc_munmap(addr unsafe.Pointer, length uintptr) int32
|
||||
|
||||
// int mprotect(void *addr, size_t len, int prot);
|
||||
//
|
||||
//export mprotect
|
||||
func libc_mprotect(addr unsafe.Pointer, len uintptr, prot int32) int32
|
||||
|
||||
// int chdir(const char *pathname, mode_t mode);
|
||||
//
|
||||
//export chdir
|
||||
func libc_chdir(pathname *byte) int32
|
||||
|
||||
// int chmod(const char *pathname, mode_t mode);
|
||||
//
|
||||
//export chmod
|
||||
func libc_chmod(pathname *byte, mode uint32) int32
|
||||
|
||||
// int mkdir(const char *pathname, mode_t mode);
|
||||
//
|
||||
//export mkdir
|
||||
func libc_mkdir(pathname *byte, mode uint32) int32
|
||||
|
||||
// int rmdir(const char *pathname);
|
||||
//
|
||||
//export rmdir
|
||||
func libc_rmdir(pathname *byte) int32
|
||||
|
||||
// int rename(const char *from, *to);
|
||||
//
|
||||
//export rename
|
||||
func libc_rename(from, to *byte) int32
|
||||
|
||||
// int symlink(const char *from, *to);
|
||||
//
|
||||
//export symlink
|
||||
func libc_symlink(from, to *byte) int32
|
||||
|
||||
// ssize_t readlink(const char *path, void *buf, size_t count);
|
||||
//
|
||||
//export readlink
|
||||
func libc_readlink(path *byte, buf *byte, count uint) int
|
||||
|
||||
// int unlink(const char *pathname);
|
||||
//
|
||||
//export unlink
|
||||
func libc_unlink(pathname *byte) int32
|
||||
|
||||
|
||||
@@ -14,10 +14,10 @@ import (
|
||||
// This function returns the error location in the darwin ABI.
|
||||
// Discovered by compiling the following code using Clang:
|
||||
//
|
||||
// #include <errno.h>
|
||||
// int getErrno() {
|
||||
// return errno;
|
||||
// }
|
||||
// #include <errno.h>
|
||||
// int getErrno() {
|
||||
// return errno;
|
||||
// }
|
||||
//
|
||||
//export __error
|
||||
func libc___error() *int32
|
||||
@@ -272,9 +272,11 @@ func Getpagesize() int {
|
||||
}
|
||||
|
||||
// int pipe(int32 *fds);
|
||||
//
|
||||
//export pipe
|
||||
func libc_pipe(fds *int32) int32
|
||||
|
||||
// int getpagesize();
|
||||
//
|
||||
//export getpagesize
|
||||
func libc_getpagesize() int32
|
||||
|
||||
@@ -14,21 +14,26 @@ import (
|
||||
// It not needed on arm64.
|
||||
|
||||
// struct DIR * buf fdopendir(int fd);
|
||||
//
|
||||
//export fdopendir$INODE64
|
||||
func libc_fdopendir(fd int32) unsafe.Pointer
|
||||
|
||||
// int readdir_r(struct DIR * buf, struct dirent *entry, struct dirent **result);
|
||||
//
|
||||
//export readdir_r$INODE64
|
||||
func libc_readdir_r(unsafe.Pointer, unsafe.Pointer, unsafe.Pointer) int32
|
||||
|
||||
// int stat(const char *path, struct stat * buf);
|
||||
//
|
||||
//export stat$INODE64
|
||||
func libc_stat(pathname *byte, ptr unsafe.Pointer) int32
|
||||
|
||||
// int fstat(int fd, struct stat * buf);
|
||||
//
|
||||
//export fstat$INODE64
|
||||
func libc_fstat(fd int32, ptr unsafe.Pointer) int32
|
||||
|
||||
// int lstat(const char *path, struct stat * buf);
|
||||
//
|
||||
//export lstat$INODE64
|
||||
func libc_lstat(pathname *byte, ptr unsafe.Pointer) int32
|
||||
|
||||
@@ -8,21 +8,26 @@ import (
|
||||
)
|
||||
|
||||
// struct DIR * buf fdopendir(int fd);
|
||||
//
|
||||
//export fdopendir
|
||||
func libc_fdopendir(fd int32) unsafe.Pointer
|
||||
|
||||
// int readdir_r(struct DIR * buf, struct dirent *entry, struct dirent **result);
|
||||
//
|
||||
//export readdir_r
|
||||
func libc_readdir_r(unsafe.Pointer, unsafe.Pointer, unsafe.Pointer) int32
|
||||
|
||||
// int stat(const char *path, struct stat * buf);
|
||||
//
|
||||
//export stat
|
||||
func libc_stat(pathname *byte, ptr unsafe.Pointer) int32
|
||||
|
||||
// int fstat(int fd, struct stat * buf);
|
||||
//
|
||||
//export fstat
|
||||
func libc_fstat(fd int32, ptr unsafe.Pointer) int32
|
||||
|
||||
// int lstat(const char *path, struct stat * buf);
|
||||
//
|
||||
//export lstat
|
||||
func libc_lstat(pathname *byte, ptr unsafe.Pointer) int32
|
||||
|
||||
@@ -302,13 +302,16 @@ func Getpagesize() int {
|
||||
}
|
||||
|
||||
// int stat(const char *path, struct stat * buf);
|
||||
//
|
||||
//export stat
|
||||
func libc_stat(pathname *byte, ptr unsafe.Pointer) int32
|
||||
|
||||
// int fstat(fd int, struct stat * buf);
|
||||
//
|
||||
//export fstat
|
||||
func libc_fstat(fd int32, ptr unsafe.Pointer) int32
|
||||
|
||||
// int lstat(const char *path, struct stat * buf);
|
||||
//
|
||||
//export lstat
|
||||
func libc_lstat(pathname *byte, ptr unsafe.Pointer) int32
|
||||
|
||||
Reference in New Issue
Block a user