From e8f0be85862bbb19c0d2d1520b07514d07046479 Mon Sep 17 00:00:00 2001 From: Craig Date: Sun, 5 Apr 2020 01:25:30 +0000 Subject: [PATCH] Update golang --- .devcontainer/Dockerfile | 139 ++++++++++++++++++++------------------- 1 file changed, 72 insertions(+), 67 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index ddeef63b..57dd59dd 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -18,13 +18,24 @@ RUN set -eux; apt-get update; apt-get install -y --no-install-recommends \ fi # -# set up env for gst +# Install libclipboard +RUN set -eux; \ + cd /tmp ; \ + git clone https://github.com/jtanx/libclipboard ; \ + cd libclipboard ; \ + cmake . ; \ + make -j4; \ + make install; \ + rm -rf /tmp/libclipboard + +# +# Set up env for gst ENV PATH=/gst/local/bin:$PATH ENV LD_LIBRARY_PATH=/gst/local/lib:$LD_LIBRARY_PATH ENV PKG_CONFIG_PATH=/gst/local/lib/pkgconfig:$PKG_CONFIG_PATH # -# add node +# Add node ENV NODE_VERSION 12.14.1 RUN set -eux; \ ARCH= ; dpkgArch="$(dpkg --print-architecture)" \ @@ -64,56 +75,44 @@ RUN set -eux; \ ln -s /usr/local/bin/node /usr/local/bin/nodejs # -# add go -ENV GOLANG_VERSION 1.13.6 +# Add golang +ENV GOLANG_VERSION 1.14.1 RUN set -eux; \ - dpkgArch="$(dpkg --print-architecture)"; \ - case "${dpkgArch##*-}" in \ - amd64) goRelArch='linux-amd64'; goRelSha256='a1bc06deb070155c4f67c579f896a45eeda5a8fa54f35ba233304074c4abbbbd' ;; \ - armhf) goRelArch='linux-armv6l'; goRelSha256='37a1a83e363dcf146a67fa839d170fd1afb13009585fdd493d0a3370fbe6f785' ;; \ - arm64) goRelArch='linux-arm64'; goRelSha256='0a18125c4ed80f9c3045cf92384670907c4796b43ed63c4307210fe93e5bbca5' ;; \ - i386) goRelArch='linux-386'; goRelSha256='27feb013106da784f09e560720aa41ab395c67f7eed4c4a0fce04bc6e3d01c7d' ;; \ - ppc64el) goRelArch='linux-ppc64le'; goRelSha256='26a977a8af5dc50a562f0a57b58dded5fa3bacfe77722cf8a84ea54ca54728dd' ;; \ - s390x) goRelArch='linux-s390x'; goRelSha256='5cd9900a1fa0f0cac657930b648381cad9b8c5e2bbc77caf86a6fb5cedad0017' ;; \ - *) goRelArch='src'; goRelSha256='aae5be954bdc40bcf8006eb77e8d8a5dde412722bc8effcdaf9772620d06420c'; \ - echo >&2; echo >&2 "warning: current architecture ($dpkgArch) does not have a corresponding Go binary release; will be building from source"; echo >&2 ;; \ - esac; \ - url="https://golang.org/dl/go${GOLANG_VERSION}.${goRelArch}.tar.gz"; \ - wget -O go.tgz "$url"; \ - echo "${goRelSha256} *go.tgz" | sha256sum -c - ; \ - tar -C /usr/local -xzf go.tgz; \ - rm go.tgz; \ - if [ "$goRelArch" = 'src' ]; then \ - echo >&2; \ - echo >&2 'error: UNIMPLEMENTED'; \ - echo >&2 'TODO install golang-any from jessie-backports for GOROOT_BOOTSTRAP (and uninstall after build)'; \ - echo >&2; \ - exit 1; \ - fi; \ - export PATH="/usr/local/go/bin:$PATH"; \ - go version + dpkgArch="$(dpkg --print-architecture)"; \ + case "${dpkgArch##*-}" in \ + amd64) goRelArch='linux-amd64'; goRelSha256='2f49eb17ce8b48c680cdb166ffd7389702c0dec6effa090c324804a5cac8a7f8' ;; \ + armhf) goRelArch='linux-armv6l'; goRelSha256='04f10e345dae0d7c6c32ffd6356b47f2d4d0e8a0cb757f4ef48ead6c5bef206f' ;; \ + arm64) goRelArch='linux-arm64'; goRelSha256='5d8f2c202f35481617e24e63cca30c6afb1ec2585006c4a6ecf16c5f4928ab3c' ;; \ + i386) goRelArch='linux-386'; goRelSha256='92d465accdebbe2d0749b2f90c22ecb1fd2492435144923f88ce410cd56b6546' ;; \ + ppc64el) goRelArch='linux-ppc64le'; goRelSha256='6559201d452ee2782dfd684d59c05e3ecf789dc40a7ec0ad9ae2dd9f489c0fe1' ;; \ + s390x) goRelArch='linux-s390x'; goRelSha256='af009bd6e7729c441fec78af427743fefbf11f919c562e01b37836d835f74226' ;; \ + *) goRelArch='src'; goRelSha256='2ad2572115b0d1b4cb4c138e6b3a31cee6294cb48af75ee86bec3dca04507676'; \ + echo >&2; echo >&2 "warning: current architecture ($dpkgArch) does not have a corresponding Go binary release; will be building from source"; echo >&2 ;; \ + esac; \ + url="https://golang.org/dl/go${GOLANG_VERSION}.${goRelArch}.tar.gz"; \ + wget -O go.tgz "$url"; \ + echo "${goRelSha256} *go.tgz" | sha256sum -c -; \ + tar -C /usr/local -xzf go.tgz; \ + rm go.tgz; \ + if [ "$goRelArch" = 'src' ]; then \ + echo >&2; \ + echo >&2 'error: UNIMPLEMENTED'; \ + echo >&2 'TODO install golang-any from jessie-backports for GOROOT_BOOTSTRAP (and uninstall after build)'; \ + echo >&2; \ + exit 1; \ + fi; \ + export PATH="/usr/local/go/bin:$PATH"; \ + go version ENV GOPATH /go ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH # -# install libclipboard -RUN set -eux; \ - cd /tmp ; \ - git clone https://github.com/jtanx/libclipboard ; \ - cd libclipboard ; \ - cmake . ; \ - make -j4; \ - make install; \ - rm -rf /tmp/libclipboard - -# -# install Go tools w/module support -RUN set -eux; \ - mkdir -p /tmp/gotools; \ - cd /tmp/gotools; \ - GO111MODULE=on go get -v golang.org/x/tools/gopls@latest 2>&1; \ - GO111MODULE=on go get -v \ +# Install Go tools w/module support +RUN mkdir -p /tmp/gotools \ + && cd /tmp/gotools \ + && GOPATH=/tmp/gotools GO111MODULE=on go get -v golang.org/x/tools/gopls@latest 2>&1 \ + && GOPATH=/tmp/gotools GO111MODULE=on go get -v \ honnef.co/go/tools/...@latest \ golang.org/x/tools/cmd/gorename@latest \ golang.org/x/tools/cmd/goimports@latest \ @@ -125,7 +124,7 @@ RUN set -eux; \ github.com/sqs/goreturns@latest \ github.com/josharian/impl@latest \ github.com/davidrjenni/reftools/cmd/fillstruct@latest \ - github.com/uudashr/gopkgs/cmd/gopkgs@latest \ + github.com/uudashr/gopkgs/v2/cmd/gopkgs@latest \ github.com/ramya-rao-a/go-outline@latest \ github.com/acroca/go-symbols@latest \ github.com/godoctor/godoctor@latest \ @@ -133,37 +132,43 @@ RUN set -eux; \ github.com/zmb3/gogetdoc@latest \ github.com/fatih/gomodifytags@latest \ github.com/mgechev/revive@latest \ - github.com/go-delve/delve/cmd/dlv@latest 2>&1; \ + github.com/go-delve/delve/cmd/dlv@latest 2>&1 \ # - # install Go tools w/o module support - go get -v github.com/alecthomas/gometalinter 2>&1; \ + # Build Go tools w/o module support + && GOPATH=/tmp/gotools go get -v github.com/alecthomas/gometalinter 2>&1 \ # - # install gocode-gomod - go get -x -d github.com/stamblerre/gocode 2>&1; \ - go build -o gocode-gomod github.com/stamblerre/gocode; \ - mv gocode-gomod $GOPATH/bin/; \ + # Build gocode-gomod + && GOPATH=/tmp/gotools go get -x -d github.com/stamblerre/gocode 2>&1 \ + && GOPATH=/tmp/gotools go build -o gocode-gomod github.com/stamblerre/gocode \ # - # install golangci-lint - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin 2>&1; \ - mkdir -p "$GOPATH/src" "$GOPATH/bin" "$GOPATH/pkg/mod"; chmod -R 777 "$GOPATH" + # Install Go tools + && mv /tmp/gotools/bin/* /usr/local/bin/ \ + && mv gocode-gomod /usr/local/bin/ \ + # + # Install golangci-lint + && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /usr/local/bin 2>&1 \ + # + # Setup paths + && mkdir -p "$GOPATH/src" "$GOPATH/bin" "$GOPATH/pkg/mod" \ + && chmod -R 777 "$GOPATH" + # -# turn on go modules +# Turn on go modules ENV GO111MODULE=on -# the node image includes a non-root user with sudo access. Use the "remoteUser" -# property in devcontainer.json to use it. On Linux, the container user's GID/UIDs -# will be updated to match your local UID/GID (when using the dockerFile property). +# Use the "remoteUser" property in devcontainer.json to use it. On Linux, the container +# user's GID/UIDs will be updated to match your local UID/GID (when using the dockerFile property). # See https://aka.ms/vscode-remote/containers/non-root-user for details. ARG USERNAME=neko ARG USER_UID=1000 ARG USER_GID=$USER_UID # -# set to false to skip installing zsh and Oh My ZSH! +# Set to false to skip installing zsh and Oh My ZSH! ARG INSTALL_ZSH="true" # -# location and expected SHA for common setup script - SHA generated on release +# Location and expected SHA for common setup script - SHA generated on release ARG COMMON_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/master/script-library/common-debian.sh" ARG COMMON_SCRIPT_SHA="dev-mode" @@ -172,24 +177,24 @@ ARG COMMON_SCRIPT_SHA="dev-mode" ARG COMPOSE_VERSION=1.24.0 # -# verify git, common tools / libs installed, add/modify non-root user, optionally install zsh +# Verify git, common tools / libs installed, add/modify non-root user, optionally install zsh RUN set -eux; \ wget -q -O /tmp/common-setup.sh $COMMON_SCRIPT_SOURCE; \ if [ "$COMMON_SCRIPT_SHA" != "dev-mode" ]; then echo "$COMMON_SCRIPT_SHA /tmp/common-setup.sh" | sha256sum -c - ; fi; \ /bin/bash /tmp/common-setup.sh "$INSTALL_ZSH" "$USERNAME" "$USER_UID" "$USER_GID"; \ rm /tmp/common-setup.sh; \ # - # install docker + # Install docker apt-get install -y apt-transport-https gnupg-agent software-properties-common lsb-release; \ curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/gpg | (OUT=$(apt-key add - 2>&1) || echo $OUT); \ add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable"; \ apt-get update; apt-get install -y docker-ce-cli; \ # - # install docker compose + # Install docker compose curl -sSL "https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose; \ chmod +x /usr/local/bin/docker-compose; \ # - # set alternate global install location that both users have rights to access + # Set alternate global install location that both users have rights to access mkdir -p /usr/local/share/npm-global; \ chown ${USERNAME}:root /usr/local/share/npm-global; \ npm config -g set prefix /usr/local/share/npm-global; \