envoyproxy / envoyproxy/gateway

Add CI check for "go fix"

Open
#9,706 2 comments 0 reactions 1 assignee Claimed by @mmmommm View on GitHub
stale triage
Dominant language
Go
Stars
3k
Forks
864
Avg merge
2d 2h
Merged PRs (30d)
140

Description

*Description*:
>Describe the issue.

ref: https://github.com/envoyproxy/gateway/pull/9703#issuecomment-5216630018

It would be good to add a CI check to catch issues that can be automatically detected and fixed by go fix.

Our team currently runs go fix in CI for this purpose, and I think introducing a similar check here would help prevent these issues from happening again.

For example, we could add a verification script like:

```
#!/usr/bin/env bash

set -o errexit

set -o pipefail

set -o nounset

# go fix is a built-in Go tool (Go 1.26+), no installation needed.

echo "Running command: go fix $*"

go fix "$@"
```

and expose it through a Makefile target(any command name is ok)

```
.PHONY: gofix-verify

gofix-verify:

../hack/verify-gofix.sh -diff ./...
```

The CI job could then run `make gofix-verify` and fail if `go fix -diff ./...` reports any changes.

[optional *Relevant Links*:]
>Any extra documentation required to understand the issue.

/assign

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.