Skip to content

Commit

Permalink
fmt: improve formatting (#12)
Browse files Browse the repository at this point in the history
Improve formatting of templated code.
Add a newline when printing an error in the root command.
  • Loading branch information
oncilla authored Jun 21, 2020
1 parent ac93d4e commit 130dbea
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 10 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
build:
go build -v -o bin/boa ./cmd/boa

install:
go install -v ./cmd/boa

test:
go test -v ./...

Expand All @@ -9,4 +12,3 @@ golden:

lint:
golangci-lint run

2 changes: 1 addition & 1 deletion cmd/boa/boa.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func main() {
newVersion(cmd),
)
if err := cmd.Execute(); err != nil {
fmt.Fprintf(os.Stderr, "Error: %s", err)
fmt.Fprintf(os.Stderr, "Error: %s\n", err)
os.Exit(1)
}
}
1 change: 0 additions & 1 deletion cmd/boa/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ To permanently add bash autocompletion, run:
}
},
}

cmd.Flags().StringVar(&flags.shell, "shell", "bash", "Shell type (bash|zsh|fish)")
return cmd
}
1 change: 0 additions & 1 deletion cmd/boa/testdata/init/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ To permanently add bash autocompletion, run:
}
},
}

cmd.Flags().StringVar(&flags.shell, "shell", "bash", "Shell type (bash|zsh|fish)")
return cmd
}
2 changes: 1 addition & 1 deletion cmd/boa/testdata/init/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func main() {
newVersion(cmd),
)
if err := cmd.Execute(); err != nil {
fmt.Fprintf(os.Stderr, "Error: %s", err)
fmt.Fprintf(os.Stderr, "Error: %s\n", err)
os.Exit(1)
}
}
2 changes: 0 additions & 2 deletions pkg/tmpl/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package tmpl
const Completion = `{{ if .Copyright.Author }}// Copyright {{.Copyright.Year}} {{ .Copyright.Author }}{{ end }}
{{ if .License.Commented }}{{ .License.Commented }}{{ end }}
package main
import (
Expand Down Expand Up @@ -58,7 +57,6 @@ To permanently add bash autocompletion, run:
}
},
}
cmd.Flags().StringVar(&flags.shell, "shell", "bash", "Shell type (bash|zsh|fish)")
return cmd
}
Expand Down
4 changes: 1 addition & 3 deletions pkg/tmpl/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ package tmpl
const Root = `{{ if .Copyright.Author }}// Copyright {{.Copyright.Year}} {{ .Copyright.Author }}{{ end }}
{{ if .License.Commented }}{{ .License.Commented }}{{ end }}
package main
import (
Expand All @@ -44,7 +42,7 @@ func main() {
newVersion(cmd),
)
if err := cmd.Execute(); err != nil {
fmt.Fprintf(os.Stderr, "Error: %s", err)
fmt.Fprintf(os.Stderr, "Error: %s\n", err)
os.Exit(1)
}
}
Expand Down

0 comments on commit 130dbea

Please sign in to comment.