Skip to content

Conversation

@dolmen
Copy link
Contributor

@dolmen dolmen commented Mar 11, 2025

Remove github.com/oauth2-proxy/tools/reference-gen from dependencies. Instead we are now running it with "go run" with a version suffix.

Description

  • github.com/oauth2-proxy/tools/reference-gen is removed from tools/tool.go
  • in pkg/apis/options/doc.go we now run reference-run with a version suffix (go run package@version) with the version comming from go.mod.
  • the //go:generate line is split in 2 lines (using the -command flag) for readability
  • go mod tidy for cleaning dependencies from go.mod, go.sum

Notes:

  • we are not upgrading reference-gen here. That will be a further separate change.
  • go 1.24 has builtin support for tools in go.mod, however the solution here doesn't require go 1.24

Motivation and Context

Cleanup dependencies from go.mod which are used only for development.

How Has This Been Tested?

$ go generate -v ./...
$ git diff --exit-code
$ echo $?
0

=> no change in code generation

Checklist:

  • My change requires a change to the documentation or CHANGELOG.
  • I have updated the documentation/CHANGELOG accordingly.
  • I have created a feature (non-master) branch for my PR.
  • I have written tests for my code changes.

@dolmen dolmen requested a review from a team as a code owner March 11, 2025 10:41
@github-actions github-actions bot added dependencies Pull requests that update a dependency file go labels Mar 11, 2025
@dolmen dolmen changed the title Remove tools/reference-gen from go.mod Remove go:generate from go.mod Mar 11, 2025
@dolmen dolmen changed the title Remove go:generate from go.mod Remove go:generate dependencies from go.mod Mar 11, 2025
@dolmen
Copy link
Contributor Author

dolmen commented Mar 11, 2025

Cc: @tuunit as you authored oauth2-proxy/tools#4

Copy link
Member

@tuunit tuunit left a comment

Choose a reason for hiding this comment

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

@dolmen looks amazing!

Please add an CHANGELOG.md entry 😄 and then we are good to merge.

@tuunit tuunit changed the title Remove go:generate dependencies from go.mod chore(dep): remove go:generate dependencies from go.mod Mar 12, 2025
@dolmen dolmen force-pushed the fix-dependency-on-reference-gen branch from 66835f7 to 59cad2c Compare March 18, 2025 22:29
@github-actions github-actions bot added the docs label Mar 18, 2025
Remove github.com/oauth2-proxy/tools/reference-gen from dependencies.
Instead we are now running it with "go run" with a version suffix.

Long version:
- github.com/oauth2-proxy/tools/reference-gen is removed from
  tools/tool/go
- in pkg/apis/options/doc.go we now run reference-run with a version
  suffix (go run package@version) with the version comming from go.mod.
- the "//go:generate" line is split in 2 lines (using the -command
  flag) for readability
- "go mod tidy" for cleaning dependencies from go.mod, go.sum

Note: we are not upgrading reference-gen here. That will be a further
separate change.
@dolmen dolmen force-pushed the fix-dependency-on-reference-gen branch from 59cad2c to 8e951ab Compare March 18, 2025 22:31
@dolmen
Copy link
Contributor Author

dolmen commented Mar 18, 2025

Please add an CHANGELOG.md entry 😄 and then we are good to merge.

@tuunit Done!

Copy link
Member

@tuunit tuunit left a comment

Choose a reason for hiding this comment

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

LGTM

@tuunit tuunit merged commit 8a8fcab into oauth2-proxy:master Mar 18, 2025
6 checks passed
@dolmen dolmen deleted the fix-dependency-on-reference-gen branch April 2, 2025 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file docs go

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants