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

Building DockerImage fails with the current Go version #106

Closed
soodpr opened this issue Sep 11, 2018 · 4 comments
Closed

Building DockerImage fails with the current Go version #106

soodpr opened this issue Sep 11, 2018 · 4 comments
Assignees

Comments

@soodpr
Copy link
Member

soodpr commented Sep 11, 2018

Trying to build the image results in below error:
Step 1/6 : FROM golang:1.6.2

---> 8ecba0e9bd48

Step 2/6 : RUN go get github.com/golang/lint/golint github.com/mattn/goveralls golang.org/x/tools/cover github.com/tools/godep github.com/aktau/github-release

---> Running in 44f55cfe816c

�[91m# golang.org/x/tools/go/internal/gcimporter
src/golang.org/x/tools/go/internal/gcimporter/iimport.go:90: undefined: io.SeekCurrent
src/golang.org/x/tools/go/internal/gcimporter/iimport.go:93: undefined: io.SeekCurrent
src/golang.org/x/tools/go/internal/gcimporter/iimport.go:169: undefined: io.SeekCurrent
src/golang.org/x/tools/go/internal/gcimporter/iimport.go:200: r.declReader.Reset undefined (type bytes.Reader has no field or method Reset)
src/golang.org/x/tools/go/internal/gcimporter/iimport.go:239: r.declReader.Reset undefined (type bytes.Reader has no field or method Reset)
�[0m
�[91m# github.com/aktau/github-release
src/github.com/aktau/github-release/cmd.go:96: enc.SetIndent undefined (type *json.Encoder has no field or method SetIndent)
�[0m
Removing intermediate container 44f55cfe816c

The command '/bin/sh -c go get github.com/golang/lint/golint github.com/mattn/goveralls golang.org/x/tools/cover github.com/tools/godep github.com/aktau/github-release' returned a non-zero code: 2

Solution: Can be fixed by upgrading the Go version from 1.6.2 to 1.10.4

@soodpr soodpr self-assigned this Sep 11, 2018
@patrickdappollonio
Copy link
Member

patrickdappollonio commented Sep 11, 2018

Hello @soodpr,

I'm no longer with HPE but I used to work on this project before. You're technically not using the vendored dependencies, but rather, using your own. Rather than using go get to fetch the dependencies, please use glide, or by default, pin the dependency versions to the proper versions as specified in the glide.lock file.

The project pulls with no issue at all... If you do go get -u github.com/HewlettPackard/oneview-golang the download is successful and after doing go test you do get:

?   	github.com/HewlettPackard/oneview-golang	[no test files]
?   	github.com/HewlettPackard/oneview-golang/i3s	[no test files]
?   	github.com/HewlettPackard/oneview-golang/icsp	[no test files]
ok  	github.com/HewlettPackard/oneview-golang/liboneview	0.016s
?   	github.com/HewlettPackard/oneview-golang/ov	[no test files]
ok  	github.com/HewlettPackard/oneview-golang/rest	0.019s
ok  	github.com/HewlettPackard/oneview-golang/testconfig	0.009s [no tests to run]
ok  	github.com/HewlettPackard/oneview-golang/utils	0.016s

Edit: I'm building the app with Go 1.11. Go has a compatibility promise. As long as the code doesn't change you can build old Go applications with newer versions of Go, so updating from Go 1.6.2 to 1.10.4 shouldn't make a difference in compilation result, but rather only in the compiled binary.

@dh2mom247
Copy link
Collaborator

+1 - thanks Patrick!

@soodpr
Copy link
Member Author

soodpr commented Sep 11, 2018

@patrickdappollonio - Thanks for the response. I am trying to build the docker image which refers to DockerFile that contains go get commands as shown here https://github.com/HewlettPackard/oneview-golang/blob/ac3de6c231b1527a7ee0197f182b30f063d11416/Dockerfile#L3

I've modified the Go version to 1.10.4 and was able to build the docker image with the docker build command. So, thought that go get commands are failing with the previous GO version.

@patrickdappollonio
Copy link
Member

patrickdappollonio commented Sep 11, 2018

Unfortunately, during my time there, I don't think anyone updated that file after we moved the code to glide. I can provide some updated Dockerfile in a couple of hours if you guys can wait.

Edit: most likely that Dockerfile was going to be used eventually to automate releases via Github (the project github-release is being pulled), which makes me believe it wasn't really used. You can remove these lines or leave something like this:

FROM golang:1.11

WORKDIR /go/src/github.com/HewlettPackard/oneview-golang

COPY . /go/src/github.com/HewlettPackard/oneview-golang
RUN go build github.com/HewlettPackard/oneview-golang

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

No branches or pull requests

3 participants