diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e3aba19..761a874 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,27 @@ on: - '*' jobs: + gofmt: + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v2 + - name: Set up Go + uses: actions/setup-go@v2.1.4 + with: + go-version: 1.16 + id: go + # Check the codebase has been formatted by `gofmt`. + # We run two `gofmt` commands for different purposes: + # 1. `gofmt -d .`: to print diffs in the CI log if any. + # 2. `gofmt -l`: to test there is a diff in the codebase. This is because + # `gofmt` exits with exit status 0 even if there is a diff. + # This is recommended in https://github.com/golang/go/issues/24230) + - name: Run gofmt + run: | + gofmt -d . + test -z $(gofmt -l .) + linux-tests: runs-on: ubuntu-20.04 diff --git a/fuseops/ops.go b/fuseops/ops.go index 8af3d51..7902a0e 100644 --- a/fuseops/ops.go +++ b/fuseops/ops.go @@ -311,7 +311,7 @@ type CreateFileOp struct { // The handle may be supplied in future ops like ReadFileOp that contain a // file handle. The file system must ensure this ID remains valid until a // later call to ReleaseFileHandle. - Handle HandleID + Handle HandleID OpContext OpContext } @@ -787,8 +787,8 @@ type SyncFileOp struct { // return any errors that occur. type FlushFileOp struct { // The file and handle being flushed. - Inode InodeID - Handle HandleID + Inode InodeID + Handle HandleID OpContext OpContext } diff --git a/mount_darwin.go b/mount_darwin.go index 8558acf..35b1ace 100644 --- a/mount_darwin.go +++ b/mount_darwin.go @@ -124,7 +124,7 @@ func convertMountArgs(daemonVar string, libVar string, } } - env := []string{ libVar+"=" } + env := []string{libVar + "="} if daemonVar != "" { env = append(env, daemonVar+"="+os.Args[0]) } @@ -135,7 +135,7 @@ func convertMountArgs(daemonVar string, libVar string, // // OSXFUSE seems to ignore InitResponse.MaxWrite, and uses // this instead. - "-o", "iosize="+strconv.FormatUint(buffer.MaxWriteSize, 10), + "-o", "iosize=" + strconv.FormatUint(buffer.MaxWriteSize, 10), } return argv, env, nil