Docker build failed with error "The command '/bin/sh -c go-wrapper install # "go install -v ./..."' returned a non-zero code: 2"

My build started to fail today, with no changes from my side, with error:
“The command ‘/bin/sh -c go-wrapper install # “go install -v ./…”’ returned a non-zero code: 2”
My Dockerfile:

FROM golang:1.8
ENV VER 1b21dcc3dca54970b3599eea81df467d68e07596

# install unzip utility
RUN apt-get -y update && apt-get -y install zip

# download and unzip Dapperdox sources
RUN cd /go/src/ && \
    curl -L -o dapperdox.zip https://github.com/wix-playground/dapperdox/archive/${VER}.zip && \
    unzip dapperdox.zip && \
    rm dapperdox.zip

# compile
WORKDIR /go/src/dapperdox-${VER}

RUN go-wrapper download         # "go get -d -v ./..."
RUN go-wrapper install    # "go install -v ./..."

#........................
#........................

ENV BIND_ADDR 0.0.0.0:8080
EXPOSE 8080

When try to docker build I get:

.................
Step 7/18 : RUN go-wrapper install    # "go install -v ./..."
 ---> Running in a8b9129c7020
+ exec go install -v
github.com/gorilla/context
github.com/gorilla/mux
github.com/justinas/alice
github.com/justinas/nosurf
github.com/ian-kent/envconf
github.com/wix/dapperdox/logger
github.com/ian-kent/gofigure/sources
github.com/wix/dapperdox/navigation
github.com/ian-kent/htmlform
github.com/unrolled/render
github.com/ian-kent/gofigure
golang.org/x/net/html/atom
github.com/gorilla/pat
golang.org/x/net/html
github.com/wix/dapperdox/config
github.com/russross/blackfriday
github.com/sergi/go-diff/diffmatchpatch
github.com/sourcegraph/annotate
github.com/sourcegraph/syntaxhighlight
github.com/shurcooL/highlight_go/vendor/go/scanner
# github.com/shurcooL/highlight_go/vendor/go/scanner
../github.com/shurcooL/highlight_go/vendor/go/scanner/scanner.go:281: s.file.AddLineColumnInfo undefined (type *token.File has no field or method AddLineColumnInfo)
github.com/shurcooL/sanitized_anchor_name
github.com/go-openapi/analysis/internal
github.com/mailru/easyjson/jlexer
github.com/shurcooL/highlight_diff
github.com/mailru/easyjson/buffer
gopkg.in/yaml.v2
github.com/mailru/easyjson/jwriter
github.com/microcosm-cc/bluemonday
github.com/shurcooL/octicon
github.com/PuerkitoBio/urlesc
golang.org/x/text/transform
golang.org/x/text/unicode/bidi
golang.org/x/text/unicode/norm
golang.org/x/text/secure/bidirule
golang.org/x/text/width
golang.org/x/net/idna
github.com/asaskevich/govalidator
github.com/globalsign/mgo/internal/json
github.com/go-openapi/swag
github.com/PuerkitoBio/purell
github.com/go-openapi/errors
github.com/mitchellh/mapstructure
github.com/serenize/snaker
github.com/wix/dapperdox/handlers/specs
github.com/go-openapi/jsonpointer
github.com/globalsign/mgo/bson
github.com/wix/dapperdox/handlers/timeout
github.com/wix/dapperdox/network
github.com/go-openapi/jsonreference
github.com/wix/dapperdox/proxy
github.com/go-openapi/spec
github.com/go-openapi/strfmt
github.com/go-openapi/analysis
github.com/go-openapi/loads
The command '/bin/sh -c go-wrapper install    # "go install -v ./..."' returned a non-zero code: 2

Please advise

1.8 ist old, have you checked your dependencies if they still support 1.8?

I did nothing, and issue solved by itself.
Thanks

Anyway, you should update your version of go!

As your build stopped at github.com/go-openapi/loads, it probably failed while building it. I checked their repository and their CI does only check 1.9 and newer. 1.8 might therefore break any time and no one will realise.

Among those projects I have taken a deeper look at, it seems as if often exactly 2 versions of go are checked in CI, current and current - 1, as of today those were 1.11 and 1.10. By beeing 2 versions behind any of your deps could break anytime.

2 Likes

Yes as Norbert says. Golang is only supported for the last two versions. So using anything older than 1.10 is not recommended. See release policy on this page

https://golang.org/doc/devel/release.html

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.