Use goimports as formatting standard

given some disagreement with gofmt that seems to have shown up in 1.19
This commit is contained in:
Dan Buch 2022-08-14 10:47:42 -04:00
parent 27b456971b
commit ade5edbb7f
Signed by: meatballhat
GPG Key ID: A12F782281063434
2 changed files with 22 additions and 16 deletions

View File

@ -27,12 +27,16 @@ jobs:
- name: Set PATH - name: Set PATH
run: echo "${GITHUB_WORKSPACE}/.local/bin" >>"${GITHUB_PATH}" run: echo "${GITHUB_WORKSPACE}/.local/bin" >>"${GITHUB_PATH}"
- name: install goimports
if: matrix.go == '1.19.x' && matrix.os == 'ubuntu-latest'
run: GOBIN=${PWD}/.local/bin go install golang.org/x/tools/cmd/goimports@latest
- name: Checkout Code - name: Checkout Code
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: GOFMT Check - name: goimports check
if: matrix.go == '1.19.x' && matrix.os == 'ubuntu-latest' if: matrix.go == '1.19.x' && matrix.os == 'ubuntu-latest'
run: test -z $(gofmt -l .) run: test -z $(goimports -l .)
- name: vet - name: vet
run: go run internal/build/build.go vet run: go run internal/build/build.go vet

2
cli.go
View File

@ -1,11 +1,13 @@
// Package cli provides a minimal framework for creating and organizing command line // Package cli provides a minimal framework for creating and organizing command line
// Go applications. cli is designed to be easy to understand and write, the most simple // Go applications. cli is designed to be easy to understand and write, the most simple
// cli application can be written as follows: // cli application can be written as follows:
//
// func main() { // func main() {
// (&cli.App{}).Run(os.Args) // (&cli.App{}).Run(os.Args)
// } // }
// //
// Of course this application does not do much, so let's make this an actual application: // Of course this application does not do much, so let's make this an actual application:
//
// func main() { // func main() {
// app := &cli.App{ // app := &cli.App{
// Name: "greet", // Name: "greet",