Skip to content

Check if incoming code is gofmt-ed  #817

Closed
@jkremser

Description

Currently neither the golangci-lint run nor the gokart scan --globalsTainted --verbose do catch some things that gofmt -w -s . does to code.
We can do gofmt -l . that lists all the files that are not aligned w/ the gofmt (~something like a dry run) and check if the output is empty.

Currently it's complaining about terrratest:

 gofmt -l .
terratest/test/init.go
terratest/test/k8gb_abstract_full_roundrobin_test.go
terratest/test/k8gb_basic_app_test.go
terratest/test/k8gb_failover_playground_test.go
terratest/test/k8gb_full_failover_test.go
terratest/test/k8gb_full_roundrobin_test.go
terratest/test/k8gb_ingress_annotation_failover_test.go
terratest/test/k8gb_ingress_annotation_rr_test.go
terratest/test/k8gb_lifecycle_test.go
terratest/test/k8gb_split_failover_test.go

I've checked couple of those and it's my work, perhaps I will setup also some pre-commit hook w/ gofmt. We could have this also in the repo itself, but it might be controversial.

note:
gofmt has an option -s that can simplify the code and these wannabe modifications are not listed w/ -l, but these can be checked by gofmt -s -d . (again if the output is empty, we are good)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status

      Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions