-
Notifications
You must be signed in to change notification settings - Fork 373
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
Fix build and use go modules for build #435
Fix build and use go modules for build #435
Conversation
.travis.yml
Outdated
@@ -29,7 +29,7 @@ jobs: | |||
# Lang stage: Go | |||
- stage: lang | |||
language: go | |||
go: 1.10.4 | |||
go: 1.13.8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may be we could use go version go1.14.2 linux/amd64
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to use slightly older version on purpose, since go 1.14 was released just couple of months ago. I can change it though.
lib/go/go.sum
Outdated
@@ -0,0 +1,51 @@ | |||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does go mod tidy
clean up this dep list at all? there's a ton here..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it does not. If anything it seems to be adding one more (duplicate) dependecy:
diff --git a/lib/go/go.sum b/lib/go/go.sum
index 6f6d303..ca54368 100644
--- a/lib/go/go.sum
+++ b/lib/go/go.sum
@@ -12,6 +12,7 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
+github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
lib/go/go.mod
Outdated
@@ -0,0 +1,8 @@ | |||
module github.com/container-storage-interface/spec/lib/go/csi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this go.mod file should be moved into lib/go/csi
instead of keeping it adjacent to the Makefile?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, it seems logical to have it here since top level csi package declaration exists in this directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks like the (empty) top level file was put there to satisfy go-dep, which didn't support multiple modules per repo unlike go mod
. i'd rather be more precise with our module definitions.
would strongly prefer to move the go.mod file as suggested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, this is tricker. I am okay with moving go.mod file to csi directory but it looks like even though our build is green, having go.mod file in a subdirectory prevents the csi module from being usable.
afaict - if we want to use go modules, we will have to place go.mod at the root of the repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I'll let @jdef review and approve this. |
b159550
to
1e5a9bd
Compare
@gnufied have you tried placing go.mod in both the root dir and in lib/go/csi (like many multiple module go project)? |
@jieyu I have and it looks like exporting/publishing a module from a subdirectory is treated different from how local multiple modules refer each other from same repo. Take https://github.com/gnufied/sandbox2/tree/v1.8.0 for example. If you go get
|
maybe we should not yet upgrade to go.mod and instead patch the makefile to
pin the grpc-go version like it already does for protobufs
…On Thu, May 28, 2020 at 5:29 PM Hemant Kumar ***@***.***> wrote:
@jieyu <https://github.com/jieyu> I have and it looks like
exporting/publishing a repsitory from a subdirectory is treated different
from how local multiple modules refer each other from same repo.
Take https://github.com/gnufied/sandbox2/tree/v1.8.0 for example. If you
go get
~> go get ***@***.***
# you get an empty clone in ***@***.*** with just go.mod file
# get nested module
~> go get ***@***.***
go: finding github.com/gnufied/sandbox2/lib/spec/sandbox v1.8.0
go: finding github.com v1.8.0
go: finding github.com/gnufied/sandbox2/lib/spec v1.8.0
go: finding github.com/gnufied/sandbox2/lib v1.8.0
go: finding github.com/gnufied v1.8.0
go: extracting github.com/gnufied/sandbox2 v1.8.0
go get ***@***.***: module ***@***.*** found, but does not contain package github.com/gnufied/sandbox2/lib/spec/sandbox
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#435 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAR5KLCPXDT6GW57OYPAUVDRT3JT3ANCNFSM4NIABGNQ>
.
--
James DeFelice
585.241.9488 (voice)
650.649.6071 (fax)
|
@jdef the trick is - we will have to probably pin This PR however works at the cost of having
Alternately we can start thinking about moving language bindings in their own repo, which will be more cleaner (and may be take the bitter pill of pinning version via Makefile for now) |
LGTM |
Discussed this offline. Given the concerns that @jdef raised, and since we are so close to cutting a CSI 1.3, we agreed to go with the less risky (but more hacky) approach (patch the makefile to pin the grpc-go version), and move to go mod approach afterwards for the CSI 1.4 release. This is just to mitigate unforeseen issues with switching to go modules and rushing the decision before we can think it though. Thank you @gnufied for your patience and for driving this! |
Doesn't look like there is a cleaner way to do this. golang/go#34055 asks for the ability to serve a module from a subdirectory but the proposed solution won't work for us because it depends on being able to return a
Pinning dependencies in this way is a game of whack-a-mole. For example, the build is broken again right now.
That seems like a lot of unnecessary overhead.
I am in favor of this approach. |
Update travis to use go 1.13
Thanks @gnufied /lgtm Anyone have any objections to this change? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
@@ -29,10 +29,10 @@ jobs: | |||
# Lang stage: Go | |||
- stage: lang | |||
language: go | |||
go: 1.10.4 | |||
go: 1.16.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huge bump here :-) but nice!
lgtm from my side as well 👍 |
Thanks everyone, merging! |
Use go modules to pin dependency versions.
Fixes #434