Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup go.mod handling of helpers #3576

Merged
merged 1 commit into from Apr 28, 2021
Merged

Cleanup go.mod handling of helpers #3576

merged 1 commit into from Apr 28, 2021

Conversation

jeffwidman
Copy link
Member

Since go.mod in the root of helpers declares itself as:

module github.com/dependabot/dependabot-core/go_modules/helpers

then my understanding is there's no need to have custom replace
directives... go is smart enough to realize that these are local pkgs
and should be imported locally.

As a result, we also no longer need a custom go.mod file within the
subpackage.

Which makes life easier as this subpackage declared an older version of
the extracted go modules repo... which works, but can be confusing since
there are two go.mod files with slightly different minimum supported
versions. Avoid all that by treating this as a package of the parent
modules rather than a standalone module.

Since `go.mod` in the root of helpers declares itself as:
```
module github.com/dependabot/dependabot-core/go_modules/helpers
```

then my understanding is there's no need to have custom replace
directives... `go` is smart enough to realize that these are local pkgs
and should be imported locally.

As a result, we also no longer need a custom `go.mod` file within the
subpackage.

Which makes life easier as this subpackage declared an older version of
the extracted go modules repo... which works, but can be confusing since
there are two `go.mod` files with slightly different minimum supported
versions. Avoid all that by treating this as a package of the parent
modules rather than a standalone module.
@jeffwidman
Copy link
Member Author

This same cleanup could be applied to the dep helpers, but I'd rather see that solved by simply deleting dep entirely: #3538

Copy link
Contributor

@thepwagner thepwagner left a comment

Choose a reason for hiding this comment

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

Yep, thanks for cleaning this up!

go mod graph

Pre

github.com/dependabot/dependabot-core/go_modules/helpers github.com/Masterminds/vcs@v1.13.1
github.com/dependabot/dependabot-core/go_modules/helpers github.com/dependabot/dependabot-core/go_modules/helpers/updater@v0.0.0
github.com/dependabot/dependabot-core/go_modules/helpers github.com/dependabot/gomodules-extracted@v1.2.0
github.com/dependabot/dependabot-core/go_modules/helpers golang.org/x/mod@v0.4.2
github.com/dependabot/dependabot-core/go_modules/helpers/updater@v0.0.0 github.com/dependabot/gomodules-extracted@v0.0.0-20181020215834-1b2f850478a3
golang.org/x/mod@v0.4.2 golang.org/x/crypto@v0.0.0-20191011191535-87dc89f01550
golang.org/x/mod@v0.4.2 golang.org/x/tools@v0.0.0-20191119224855-298f0cb1881e
golang.org/x/mod@v0.4.2 golang.org/x/xerrors@v0.0.0-20191011141410-1b5146add898
golang.org/x/crypto@v0.0.0-20191011191535-87dc89f01550 golang.org/x/net@v0.0.0-20190404232315-eb5bcb51f2a3
golang.org/x/crypto@v0.0.0-20191011191535-87dc89f01550 golang.org/x/sys@v0.0.0-20190412213103-97732733099d
golang.org/x/tools@v0.0.0-20191119224855-298f0cb1881e golang.org/x/net@v0.0.0-20190620200207-3b0461eec859
golang.org/x/tools@v0.0.0-20191119224855-298f0cb1881e golang.org/x/sync@v0.0.0-20190423024810-112230192c58
golang.org/x/tools@v0.0.0-20191119224855-298f0cb1881e golang.org/x/xerrors@v0.0.0-20190717185122-a985d3407aa7
golang.org/x/net@v0.0.0-20190404232315-eb5bcb51f2a3 golang.org/x/crypto@v0.0.0-20190308221718-c2843e01d9a2
golang.org/x/net@v0.0.0-20190404232315-eb5bcb51f2a3 golang.org/x/text@v0.3.0
golang.org/x/net@v0.0.0-20190620200207-3b0461eec859 golang.org/x/crypto@v0.0.0-20190308221718-c2843e01d9a2
golang.org/x/net@v0.0.0-20190620200207-3b0461eec859 golang.org/x/sys@v0.0.0-20190215142949-d0b11bdaac8a
golang.org/x/net@v0.0.0-20190620200207-3b0461eec859 golang.org/x/text@v0.3.0
golang.org/x/crypto@v0.0.0-20190308221718-c2843e01d9a2 golang.org/x/sys@v0.0.0-20190215142949-d0b11bdaac8a

Post:

github.com/dependabot/dependabot-core/go_modules/helpers github.com/Masterminds/vcs@v1.13.1
github.com/dependabot/dependabot-core/go_modules/helpers github.com/dependabot/gomodules-extracted@v1.2.0
github.com/dependabot/dependabot-core/go_modules/helpers golang.org/x/mod@v0.4.2
golang.org/x/mod@v0.4.2 golang.org/x/crypto@v0.0.0-20191011191535-87dc89f01550
golang.org/x/mod@v0.4.2 golang.org/x/tools@v0.0.0-20191119224855-298f0cb1881e
golang.org/x/mod@v0.4.2 golang.org/x/xerrors@v0.0.0-20191011141410-1b5146add898
golang.org/x/crypto@v0.0.0-20191011191535-87dc89f01550 golang.org/x/net@v0.0.0-20190404232315-eb5bcb51f2a3
golang.org/x/crypto@v0.0.0-20191011191535-87dc89f01550 golang.org/x/sys@v0.0.0-20190412213103-97732733099d
golang.org/x/tools@v0.0.0-20191119224855-298f0cb1881e golang.org/x/net@v0.0.0-20190620200207-3b0461eec859
golang.org/x/tools@v0.0.0-20191119224855-298f0cb1881e golang.org/x/sync@v0.0.0-20190423024810-112230192c58
golang.org/x/tools@v0.0.0-20191119224855-298f0cb1881e golang.org/x/xerrors@v0.0.0-20190717185122-a985d3407aa7
golang.org/x/net@v0.0.0-20190404232315-eb5bcb51f2a3 golang.org/x/crypto@v0.0.0-20190308221718-c2843e01d9a2
golang.org/x/net@v0.0.0-20190404232315-eb5bcb51f2a3 golang.org/x/text@v0.3.0
golang.org/x/net@v0.0.0-20190620200207-3b0461eec859 golang.org/x/crypto@v0.0.0-20190308221718-c2843e01d9a2
golang.org/x/net@v0.0.0-20190620200207-3b0461eec859 golang.org/x/sys@v0.0.0-20190215142949-d0b11bdaac8a
golang.org/x/net@v0.0.0-20190620200207-3b0461eec859 golang.org/x/text@v0.3.0
golang.org/x/crypto@v0.0.0-20190308221718-c2843e01d9a2 golang.org/x/sys@v0.0.0-20190215142949-d0b11bdaac8a

Diff:

2d1
< github.com/dependabot/dependabot-core/go_modules/helpers github.com/dependabot/dependabot-core/go_modules/helpers/updater@v0.0.0
5d3
< github.com/dependabot/dependabot-core/go_modules/helpers/updater@v0.0.0 github.com/dependabot/gomodules-extracted@v0.0.0-20181020215834-1b2f850478a3

@thepwagner thepwagner merged commit 3dffae3 into dependabot:main Apr 28, 2021
@jeffwidman
Copy link
Member Author

@thepwagner just curious--why include the go mod graph output? What does it help prove/disprove for this code change? Please educate me.

@jeffwidman jeffwidman deleted the cleanup-go-mod-for-helpers branch April 28, 2021 17:12
@thepwagner
Copy link
Contributor

What does it help prove/disprove for this code change?

My intent was to demonstrate that nothing changes: by removing github.com/dependabot/dependabot-core/go_modules/helpers/updater , we remove the dependency on the outdated github.com/dependabot/gomodules-extracted@v0.0.0-20181020215834-1b2f850478a3 and the rest of is unchanged.

Completely unnecessary, but it was how I double-checked so I wanted to store it.

@jeffwidman
Copy link
Member Author

Thanks, that makes sense. I'll keep that trick in mind for my own work. I'm always amazed how contributing to open source is often the best teacher of little tricks like this.

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.

None yet

2 participants