Skip to content

Add goimports to .golangci.yaml and fix lint errors#187

Open
Troy Chiu (troychiu) wants to merge 1 commit into
agent-substrate:mainfrom
troychiu:lint-goimports
Open

Add goimports to .golangci.yaml and fix lint errors#187
Troy Chiu (troychiu) wants to merge 1 commit into
agent-substrate:mainfrom
troychiu:lint-goimports

Conversation

@troychiu

@troychiu Troy Chiu (troychiu) commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Add goimports to .golangci.yaml to follow Go import organization best practice and fix corresponding lint error.

@ameukam

Copy link
Copy Markdown
Contributor

@BenTheElder Benjamin Elder (BenTheElder) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint errors that require manually fixing but are in fact auto-formatted are ... pretty annoying, it just forces people to manually do what could've been automated.

Can we consider goimports in the gofmt flow instead?

cc Tim Hockin (@thockin)

@troychiu

Copy link
Copy Markdown
Contributor Author

Lint errors that require manually fixing but are in fact auto-formatted are ... pretty annoying, it just forces people to manually do what could've been automated.

I'm not sure if I fully understood your point, but using golangci-lint run --fix formats them automatically.

@BenTheElder

Copy link
Copy Markdown
Collaborator

I'm not sure if I fully understood your point, but using golangci-lint run --fix formats them automatically.

Hmm, does that change anything else?

We have make update which does gofmt etc. I'd want it to happen when I call this, but it also seems semi-redundant to gofmt (can we dedupe?)

@thockin

Copy link
Copy Markdown
Collaborator

There was a reason I did gofmt and not goimports, but I can't recall it.

I do not like the idea of --fix being the norm because I have frequently disagreed with the linters.

Is the goimports linters JUST imports or is it all of gofmt, too.

The advantage of update/gofmt.sh is that it does exactly one thing. I don't care if that calls goimports instead (modulo the thing I can't remember)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants