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

Bump to Golang 1.19 #13

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ platform:
steps:
- name: build
pull: default
image: rancher/dapper:v0.4.1
image: rancher/dapper:v0.6.0
commands:
- dapper ci
volumes:
Expand Down Expand Up @@ -45,7 +45,7 @@ platform:
steps:
- name: build
pull: default
image: rancher/dapper:v0.4.1
image: rancher/dapper:v0.6.0
commands:
- dapper ci
volumes:
Expand Down Expand Up @@ -86,7 +86,7 @@ node:
steps:
- name: build
pull: default
image: rancher/dapper:v0.5.8
image: rancher/dapper:v0.6.0
commands:
- dapper ci
volumes:
Expand Down
27 changes: 4 additions & 23 deletions Dockerfile.dapper
Original file line number Diff line number Diff line change
@@ -1,31 +1,12 @@
FROM ubuntu:16.04
# FROM arm=armhf/ubuntu:16.04
FROM registry.suse.com/bci/golang:1.19-20.13

ARG DAPPER_HOST_ARCH
ENV HOST_ARCH=${DAPPER_HOST_ARCH} ARCH=${DAPPER_HOST_ARCH}

RUN apt-get update && \
apt-get install -y gcc ca-certificates git wget curl vim less file && \
rm -f /bin/sh && ln -s /bin/bash /bin/sh
RUN zypper -n in docker

ENV GOLANG_ARCH_amd64=amd64 GOLANG_ARCH_arm=armv6l GOLANG_ARCH_arm64=arm64 GOLANG_ARCH_s390x=s390x GOLANG_ARCH=GOLANG_ARCH_${ARCH} \
GOPATH=/go PATH=/go/bin:/usr/local/go/bin:${PATH} SHELL=/bin/bash

RUN wget -O - https://storage.googleapis.com/golang/go1.17.5.linux-${!GOLANG_ARCH}.tar.gz | tar -xzf - -C /usr/local && \
go get golang.org/x/lint/golint


ENV DOCKER_URL_amd64=https://get.docker.com/builds/Linux/x86_64/docker-1.10.3 \
DOCKER_URL_arm=https://github.com/rancher/docker/releases/download/v1.10.3-ros1/docker-1.10.3_arm \
DOCKER_URL_arm64=https://github.com/rancher/docker/releases/download/v1.10.3-ros1/docker-1.10.3_arm64 \
DOCKER_URL=DOCKER_URL_${ARCH}

RUN if [ "${ARCH}" == "s390x" ]; then \
curl -L https://download.docker.com/linux/static/stable/s390x/docker-18.06.3-ce.tgz | tar xzvf - && \
cp docker/docker /usr/bin/ && \
chmod +x /usr/bin/docker; \
else \
wget -O - ${!DOCKER_URL} > /usr/bin/docker && chmod +x /usr/bin/docker; \
RUN if [ "${ARCH}" == "amd64" ]; then \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.51.1; \
fi

ENV DAPPER_ENV REPO TAG
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module loglevel

go 1.17
go 1.19

require github.com/urfave/cli v1.22.5

Expand Down
15 changes: 11 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
"os"
Expand Down Expand Up @@ -88,13 +87,17 @@ func (client *Client) setLogLevel(level string) error {
return err
}
if response.StatusCode != http.StatusOK {
body, err := ioutil.ReadAll(response.Body)
body, err := io.ReadAll(response.Body)
if err != nil {
return err
}
return errors.New(strings.TrimRight(string(body), "\n"))
}
io.Copy(os.Stdout, response.Body)
_, err = io.Copy(os.Stdout, response.Body)
if err != nil {
return err
}

return nil
}

Expand All @@ -103,6 +106,10 @@ func (client *Client) getLogLevel() error {
if err != nil {
return err
}
io.Copy(os.Stdout, response.Body)
_, err = io.Copy(os.Stdout, response.Body)
if err != nil {
return err
}

return nil
}
23 changes: 12 additions & 11 deletions scripts/validate
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ cd $(dirname $0)/..

echo Running validation

PACKAGES=". $(find -name '*.go' | xargs -I{} dirname {} | cut -f2 -d/ | sort -u | grep -Ev '(^\.$|.git|.trash-cache|vendor|bin)' | sed -e 's!^!./!' -e 's!$!/...!')"

echo Running: go vet
go vet ${PACKAGES}
echo Running: golint
for i in ${PACKAGES}; do
if [ -n "$(golint $i | grep -v 'should have comment.*or be unexported' | tee /dev/stderr)" ]; then
failed=true
fi
done
test -z "$failed"
PACKAGES="$(go list ./...)"

echo Running: go fmt
test -z "$(go fmt ${PACKAGES} | tee /dev/stderr)"

if ! command -v golangci-lint; then
echo "Skipping validation on ARCH's other than linux amd64"
exit
fi

echo Running: golangci-lint
golangci-lint run


3 changes: 0 additions & 3 deletions scripts/version
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
#!/bin/bash

if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
DIRTY="-dirty"
fi

git fetch

COMMIT=$(git rev-parse --short HEAD)
GIT_TAG=$(git tag -l --contains HEAD | head -n 1)

Expand Down