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

Change current dir for go get swagger so it doesn't modify go.mod #8078

Closed
wants to merge 5 commits into from

Conversation

guillep2k
Copy link
Member

This PR fixes the CI vendor problem by keeping go get from changing go.mod every time it downloads swagger. In a long conversation with @mrsdizzie and @techknowlogick it was established that this seems to be the culprit of the latest unintended vendor changes:

Makefile:
		GO111MODULE="on" $(GO) get -u github.com/go-swagger/go-swagger/cmd/swagger@v0.20.1; \

That produces changes in gitea's go.mod every time a new version of a golang library is released.

To work around that problem I've come with this solution, which is not perfect but could work until a better one comes up.

It works by executing $(GO) get outside gitea's directory, so it won't see/modify go.mod.

Makefile Show resolved Hide resolved
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Sep 4, 2019
@lafriks lafriks added the topic/build PR changes how Gitea is built, i.e. regarding Docker or the Makefile label Sep 4, 2019
Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
@lafriks lafriks added this to the 1.10.0 milestone Sep 4, 2019
@typeless
Copy link
Contributor

typeless commented Sep 4, 2019

I am a bit confused about the issue. If the we already specify the exact version of go-swagger, wouldn't it just update the go.mod once if we have committed the change?

@guillep2k
Copy link
Member Author

I am a bit confused about the issue. If the we already specify the exact version of go-swagger, wouldn't it just update the go.mod once if we have committed the change?

You have a point, but we're not using a binary release from go-swagger. It may be pointing to master in some of its dependencies.

@mrsdizzie
Copy link
Member

See #8079 for an explanation of why current behavior causes these type of problems and should get a proper fix going forward

@typeless
Copy link
Contributor

typeless commented Sep 4, 2019

@guillep2k That sounds like a headache if a dependency could potentially have their dependencies inconstant even if the semantic version has been specified. I expected that the MVS rules of Go modules do not work that way.

@guillep2k
Copy link
Member Author

@guillep2k That sounds like a headache if a dependency could potentially have their dependencies inconstant once the semantic version has been specified. I expected that the MVS rules of Go modules do not work that way.

@typeless You are right again. @mrsdizzie explained it better in #8079.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Sep 4, 2019
@lunny
Copy link
Member

lunny commented Sep 4, 2019

We just need go-swagger as a command line tool but not depends that on gitea runtime. go get have these two feature. download a library or a tool. I think where the problem is.

@codecov-io
Copy link

codecov-io commented Sep 4, 2019

Codecov Report

Merging #8078 into master will decrease coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8078      +/-   ##
==========================================
- Coverage   41.78%   41.76%   -0.02%     
==========================================
  Files         481      481              
  Lines       64425    64425              
==========================================
- Hits        26919    26910       -9     
- Misses      34036    34046      +10     
+ Partials     3470     3469       -1
Impacted Files Coverage Δ
models/unit.go 62.16% <0%> (-5.41%) ⬇️
models/repo_indexer.go 64.63% <0%> (-2.04%) ⬇️
modules/log/event.go 64.61% <0%> (-1.03%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4cb1bdd...1986e9d. Read the comment docs.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Sep 4, 2019
@sapk sapk mentioned this pull request Sep 4, 2019
@lafriks
Copy link
Member

lafriks commented Sep 4, 2019

Closing in favor of #8087

@lafriks lafriks closed this Sep 4, 2019
@lunny lunny removed this from the 1.10.0 milestone Sep 5, 2019
@guillep2k guillep2k deleted the ci-swagger-workaround branch September 5, 2019 23:15
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/build PR changes how Gitea is built, i.e. regarding Docker or the Makefile
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants