Add gofmt CI step (#115)

zerocopy-examples
Tetsuo Kiso 2021-11-08 23:02:43 +09:00 committed by GitHub
parent c0eeb00f17
commit 7c4418392f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 5 deletions

View File

@ -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

View File

@ -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
}

View File

@ -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