Skip to content

Consider go.sum to be generated#4660

Closed
nathany wants to merge 1 commit intogithub-linguist:masterfrom
nathany:gosum
Closed

Consider go.sum to be generated#4660
nathany wants to merge 1 commit intogithub-linguist:masterfrom
nathany:gosum

Conversation

@nathany
Copy link
Copy Markdown

@nathany nathany commented Oct 3, 2019

Go 1.11 and newer include built in support for Go modules, with a user-editable go.mod file and a generated go.sum file.

This flags go.sum as a generated file so that it will be suppressed in diffs.

Checklist:

  • I am adding new or changing current functionality
    • I have added or updated the tests for the new or changed functionality.

Go 1.11 and newer include built in support for Go modules, with a user-editable go.mod file and a generated go.sum file.

This flags go.sum as a generated file so that it will be suppressed in diffs.
@Alhadis
Copy link
Copy Markdown
Collaborator

Alhadis commented Oct 3, 2019

See #4340. This was discussed in the past, and the eventual consensus was go.sum files should remain visible to be reviewed in diffs.

You can still exclude them in your projects by marking them as generated with an override. Just add this to your .gitattributes file:

go.sum linguist-generated

@Alhadis Alhadis closed this Oct 3, 2019
@nathany
Copy link
Copy Markdown
Author

nathany commented Oct 3, 2019

Apologies, I only searched against open issues and pull requests.

I respectfully disagree with the previous conclusion. When I have a pull request that updates dependencies, the actual code changes get lost after the giant go.sum diff.

While the go.mod file should be reviewed, the go.sum is generated and need not be reviewed. Also, a generated file can still be expanded as needed.

It doesn't make sense to consider Gopkg.lock and glide.lock as generated but not do the same for go.sum.

@Alhadis
Copy link
Copy Markdown
Collaborator

Alhadis commented Oct 3, 2019

Sigh... yes, this was precisely the catalyst of a long, long debate.

In any case, you still have the option of hiding these files yourself.

@nathany
Copy link
Copy Markdown
Author

nathany commented Oct 3, 2019

Thanks for the tip. Works just as desired, so now I just need to go add it to every one of my Go repos. 🤦‍♂️

I guess I can see how some people might want to review the transitive dependency changes in the diff, but I really don't see reading through go.sum as a good way to do that. A much cleaner interface would be nice. In any case, thanks for the rapid response, and providing a workaround.

pchaigno added a commit to cilium/cilium that referenced this pull request Apr 23, 2020
Mark go.sum files as generated to hide them in pull requests by default.
They can still be uncollapsed if needed. This particular .gitattributes
syntax is documented at [1].

GitHub doesn't hide them by default because some users may want to inspect
these files (see [2] upstream for details).

1 - https://github.com/github/linguist/#using-gitattributes
2 - github-linguist/linguist#4660
Signed-off-by: Paul Chaignon <paul@cilium.io>
pchaigno added a commit to cilium/cilium that referenced this pull request Apr 24, 2020
Mark go.sum files as generated to hide them in pull requests by default.
They can still be uncollapsed if needed. This particular .gitattributes
syntax is documented at [1].

GitHub doesn't hide them by default because some users may want to inspect
these files (see [2] upstream for details).

1 - https://github.com/github/linguist/#using-gitattributes
2 - github-linguist/linguist#4660
Signed-off-by: Paul Chaignon <paul@cilium.io>
pchaigno added a commit to cilium/cilium that referenced this pull request Apr 28, 2020
Mark go.sum files as generated to hide them in pull requests by default.
They can still be uncollapsed if needed. This particular .gitattributes
syntax is documented at [1].

GitHub doesn't hide them by default because some users may want to inspect
these files (see [2] upstream for details).

1 - https://github.com/github/linguist/#using-gitattributes
2 - github-linguist/linguist#4660
Signed-off-by: Paul Chaignon <paul@cilium.io>
pchaigno added a commit to cilium/cilium that referenced this pull request Apr 29, 2020
Mark go.sum files as generated to hide them in pull requests by default.
They can still be uncollapsed if needed. This particular .gitattributes
syntax is documented at [1].

GitHub doesn't hide them by default because some users may want to inspect
these files (see [2] upstream for details).

1 - https://github.com/github/linguist/#using-gitattributes
2 - github-linguist/linguist#4660
Signed-off-by: Paul Chaignon <paul@cilium.io>
pchaigno added a commit to cilium/cilium that referenced this pull request Apr 30, 2020
Mark go.sum files as generated to hide them in pull requests by default.
They can still be uncollapsed if needed. This particular .gitattributes
syntax is documented at [1].

GitHub doesn't hide them by default because some users may want to inspect
these files (see [2] upstream for details).

1 - https://github.com/github/linguist/#using-gitattributes
2 - github-linguist/linguist#4660
Signed-off-by: Paul Chaignon <paul@cilium.io>
pchaigno added a commit to cilium/cilium that referenced this pull request Apr 30, 2020
Mark go.sum files as generated to hide them in pull requests by default.
They can still be uncollapsed if needed. This particular .gitattributes
syntax is documented at [1].

GitHub doesn't hide them by default because some users may want to inspect
these files (see [2] upstream for details).

1 - https://github.com/github/linguist/#using-gitattributes
2 - github-linguist/linguist#4660
Signed-off-by: Paul Chaignon <paul@cilium.io>
pchaigno added a commit to cilium/cilium that referenced this pull request May 4, 2020
Mark go.sum files as generated to hide them in pull requests by default.
They can still be uncollapsed if needed. This particular .gitattributes
syntax is documented at [1].

GitHub doesn't hide them by default because some users may want to inspect
these files (see [2] upstream for details).

1 - https://github.com/github/linguist/#using-gitattributes
2 - github-linguist/linguist#4660
Signed-off-by: Paul Chaignon <paul@cilium.io>
joestringer pushed a commit to cilium/cilium that referenced this pull request May 4, 2020
Mark go.sum files as generated to hide them in pull requests by default.
They can still be uncollapsed if needed. This particular .gitattributes
syntax is documented at [1].

GitHub doesn't hide them by default because some users may want to inspect
these files (see [2] upstream for details).

1 - https://github.com/github/linguist/#using-gitattributes
2 - github-linguist/linguist#4660
Signed-off-by: Paul Chaignon <paul@cilium.io>
@nathany nathany deleted the gosum branch February 8, 2021 00:32
@nathany nathany restored the gosum branch February 8, 2021 00:32
@github-linguist github-linguist locked as resolved and limited conversation to collaborators Jun 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants