apply gofmt and enforce it for new commits

This commit is contained in:
tbjump 2022-06-01 16:16:31 +00:00 committed by Evan Gray
parent bf7de6b1fb
commit ba5fcc4ad8
4 changed files with 5 additions and 5 deletions

View File

@ -85,6 +85,9 @@ jobs:
- uses: actions/setup-go@v2 - uses: actions/setup-go@v2
with: with:
go-version: "1.17.5" go-version: "1.17.5"
# ensure that code is formatted
- run: GOFMT_OUTPUT="$(gofmt -l `find ./node ./event_database -name '*.go' | grep -v vendor` 2>&1)"; [ -n "$GOFMT_OUTPUT" ] && printf "All the following files are not correctly formatted\n${GOFMT_OUTPUT}\n" && exit 1"
# run linters
- run: make generate && ./lint.sh - run: make generate && ./lint.sh
# The go-ethereum and celo-blockchain packages both implement secp256k1 using the exact same header, but that causes duplicate symbols. # The go-ethereum and celo-blockchain packages both implement secp256k1 using the exact same header, but that causes duplicate symbols.
- run: cd node && go test -v -ldflags '-extldflags "-Wl,--allow-multiple-definition" ' ./... - run: cd node && go test -v -ldflags '-extldflags "-Wl,--allow-multiple-definition" ' ./...

View File

@ -7,7 +7,6 @@ import (
"os" "os"
) )
func main() { func main() {
var port int var port int
var code int var code int
@ -19,12 +18,11 @@ func main() {
flag.Parse() flag.Parse()
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request){ http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(code) w.WriteHeader(code)
fmt.Fprintf(w, "%s\n", message) fmt.Fprintf(w, "%s\n", message)
}) })
fmt.Printf("Starting server at port %d\nResponse code (%d)\nmessage (%s)\n", port, code, message) fmt.Printf("Starting server at port %d\nResponse code (%d)\nmessage (%s)\n", port, code, message)
if err := http.ListenAndServe(fmt.Sprintf(":%d", port), nil); err != nil { if err := http.ListenAndServe(fmt.Sprintf(":%d", port), nil); err != nil {
fmt.Fprintf(os.Stderr, err.Error()) fmt.Fprintf(os.Stderr, err.Error())

View File

@ -1898,4 +1898,3 @@ func (_Abi *AbiFilterer) ParseUpgraded(log types.Log) (*AbiUpgraded, error) {
event.Raw = log event.Raw = log
return event, nil return event, nil
} }