chore(go): upgrade to go1.17

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2022-02-06 13:02:24 +08:00
parent c4e24b1ab9
commit 471976f1d8
3 changed files with 117 additions and 158 deletions

View File

@ -1,105 +1,96 @@
--- ---
kind: pipeline kind: pipeline
name: testing name: testing
platform: platform:
os: linux
arch: amd64 arch: amd64
os: linux
steps: steps:
- name: vet - commands:
pull: always
image: golang:1.16
commands:
- make vet - make vet
image: golang:1.17
name: vet
pull: always
volumes: volumes:
- name: gopath - name: gopath
path: /go path: /go
- commands:
- name: lint
pull: always
image: golang:1.16
commands:
- make lint - make lint
image: golang:1.17
name: lint
pull: always
volumes: volumes:
- name: gopath - name: gopath
path: /go path: /go
- commands:
- name: misspell
pull: always
image: golang:1.16
commands:
- make misspell-check - make misspell-check
image: golang:1.17
name: misspell
pull: always
volumes: volumes:
- name: gopath - name: gopath
path: /go path: /go
- commands:
- name: test
pull: always
image: golang:1.16-alpine
commands:
- apk add git make curl perl bash build-base zlib-dev ucl-dev - apk add git make curl perl bash build-base zlib-dev ucl-dev
- make ssh-server - make ssh-server
- make test - make test
- make coverage - make coverage
image: golang:1.17-alpine
name: test
pull: always
volumes: volumes:
- name: gopath - name: gopath
path: /go path: /go
- image: robertstettner/drone-codecov
- name: codecov name: codecov
pull: always pull: always
image: robertstettner/drone-codecov
settings: settings:
token: token:
from_secret: codecov_token from_secret: codecov_token
volumes: volumes:
- name: gopath - name: gopath
temp: {} temp: {}
--- ---
depends_on:
- testing
kind: pipeline kind: pipeline
name: linux-amd64 name: linux-amd64
platform: platform:
os: linux
arch: amd64 arch: amd64
os: linux
steps: steps:
- name: build-push - commands:
pull: always
image: golang:1.16
commands:
- go build -v -ldflags '-X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/amd64/drone-ssh - go build -v -ldflags '-X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/amd64/drone-ssh
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: "0"
image: golang:1.17
name: build-push
pull: always
when: when:
event: event:
exclude: exclude:
- tag - tag
- commands:
- name: build-tag - go build -v -ldflags '-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}'
pull: always -a -o release/linux/amd64/drone-ssh
image: golang:1.16
commands:
- go build -v -ldflags '-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/amd64/drone-ssh
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: "0"
image: golang:1.17
name: build-tag
pull: always
when: when:
event: event:
- tag - tag
- commands:
- name: executable
pull: always
image: golang:1.16
commands:
- ./release/linux/amd64/drone-ssh --help - ./release/linux/amd64/drone-ssh --help
image: golang:1.17
- name: dryrun name: executable
pull: always
- image: plugins/docker:linux-amd64
name: dryrun
pull: always pull: always
image: plugins/docker:linux-amd64
settings: settings:
cache_from: appleboy/drone-ssh cache_from: appleboy/drone-ssh
daemon_off: false
dockerfile: docker/Dockerfile.linux.amd64 dockerfile: docker/Dockerfile.linux.amd64
dry_run: true dry_run: true
repo: appleboy/drone-ssh repo: appleboy/drone-ssh
@ -107,15 +98,14 @@ steps:
when: when:
event: event:
- pull_request - pull_request
- image: plugins/docker:linux-amd64
- name: publish name: publish
pull: always pull: always
image: plugins/docker:linux-amd64
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: linux-amd64 auto_tag_suffix: linux-amd64
cache_from: appleboy/drone-ssh cache_from: appleboy/drone-ssh
daemon_off: false daemon_off: "false"
dockerfile: docker/Dockerfile.linux.amd64 dockerfile: docker/Dockerfile.linux.amd64
password: password:
from_secret: docker_password from_secret: docker_password
@ -126,59 +116,53 @@ steps:
event: event:
exclude: exclude:
- pull_request - pull_request
trigger: trigger:
ref: ref:
- refs/heads/master - refs/heads/master
- refs/pull/** - refs/pull/**
- refs/tags/** - refs/tags/**
---
depends_on: depends_on:
- testing - testing
---
kind: pipeline kind: pipeline
name: linux-arm64 name: linux-arm64
platform: platform:
os: linux
arch: arm64 arch: arm64
os: linux
steps: steps:
- name: build-push - commands:
pull: always
image: golang:1.16
commands:
- go build -v -ldflags '-X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/arm64/drone-ssh - go build -v -ldflags '-X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/arm64/drone-ssh
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: "0"
image: golang:1.17
name: build-push
pull: always
when: when:
event: event:
exclude: exclude:
- tag - tag
- commands:
- name: build-tag - go build -v -ldflags '-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}'
pull: always -a -o release/linux/arm64/drone-ssh
image: golang:1.16
commands:
- go build -v -ldflags '-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/arm64/drone-ssh
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: "0"
image: golang:1.17
name: build-tag
pull: always
when: when:
event: event:
- tag - tag
- commands:
- name: executable
pull: always
image: golang:1.16
commands:
- ./release/linux/arm64/drone-ssh --help - ./release/linux/arm64/drone-ssh --help
image: golang:1.17
- name: dryrun name: executable
pull: always
- image: plugins/docker:linux-arm64
name: dryrun
pull: always pull: always
image: plugins/docker:linux-arm64
settings: settings:
cache_from: appleboy/drone-ssh cache_from: appleboy/drone-ssh
daemon_off: false
dockerfile: docker/Dockerfile.linux.arm64 dockerfile: docker/Dockerfile.linux.arm64
dry_run: true dry_run: true
repo: appleboy/drone-ssh repo: appleboy/drone-ssh
@ -186,15 +170,14 @@ steps:
when: when:
event: event:
- pull_request - pull_request
- image: plugins/docker:linux-arm64
- name: publish name: publish
pull: always pull: always
image: plugins/docker:linux-arm64
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: linux-arm64 auto_tag_suffix: linux-arm64
cache_from: appleboy/drone-ssh cache_from: appleboy/drone-ssh
daemon_off: false daemon_off: "false"
dockerfile: docker/Dockerfile.linux.arm64 dockerfile: docker/Dockerfile.linux.arm64
password: password:
from_secret: docker_password from_secret: docker_password
@ -205,59 +188,53 @@ steps:
event: event:
exclude: exclude:
- pull_request - pull_request
trigger: trigger:
ref: ref:
- refs/heads/master - refs/heads/master
- refs/pull/** - refs/pull/**
- refs/tags/** - refs/tags/**
---
depends_on: depends_on:
- testing - testing
---
kind: pipeline kind: pipeline
name: linux-arm name: linux-arm
platform: platform:
os: linux
arch: arm arch: arm
os: linux
steps: steps:
- name: build-push - commands:
pull: always
image: golang:1.16
commands:
- go build -v -ldflags '-X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/arm/drone-ssh - go build -v -ldflags '-X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/arm/drone-ssh
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: "0"
image: golang:1.17
name: build-push
pull: always
when: when:
event: event:
exclude: exclude:
- tag - tag
- commands:
- name: build-tag - go build -v -ldflags '-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}'
pull: always -a -o release/linux/arm/drone-ssh
image: golang:1.16
commands:
- go build -v -ldflags '-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/arm/drone-ssh
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: "0"
image: golang:1.17
name: build-tag
pull: always
when: when:
event: event:
- tag - tag
- commands:
- name: executable
pull: always
image: golang:1.16
commands:
- ./release/linux/arm/drone-ssh --help - ./release/linux/arm/drone-ssh --help
image: golang:1.17
- name: dryrun name: executable
pull: always
- image: plugins/docker:linux-arm
name: dryrun
pull: always pull: always
image: plugins/docker:linux-arm
settings: settings:
cache_from: appleboy/drone-ssh cache_from: appleboy/drone-ssh
daemon_off: false
dockerfile: docker/Dockerfile.linux.arm dockerfile: docker/Dockerfile.linux.arm
dry_run: true dry_run: true
repo: appleboy/drone-ssh repo: appleboy/drone-ssh
@ -265,15 +242,14 @@ steps:
when: when:
event: event:
- pull_request - pull_request
- image: plugins/docker:linux-arm
- name: publish name: publish
pull: always pull: always
image: plugins/docker:linux-arm
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: linux-arm auto_tag_suffix: linux-arm
cache_from: appleboy/drone-ssh cache_from: appleboy/drone-ssh
daemon_off: false daemon_off: "false"
dockerfile: docker/Dockerfile.linux.arm dockerfile: docker/Dockerfile.linux.arm
password: password:
from_secret: docker_password from_secret: docker_password
@ -284,37 +260,31 @@ steps:
event: event:
exclude: exclude:
- pull_request - pull_request
trigger: trigger:
ref: ref:
- refs/heads/master - refs/heads/master
- refs/pull/** - refs/pull/**
- refs/tags/** - refs/tags/**
---
depends_on: depends_on:
- testing - testing
---
kind: pipeline kind: pipeline
name: release-binary name: release-binary
platform: platform:
os: linux
arch: amd64 arch: amd64
os: linux
steps: steps:
- name: build-all-binary - commands:
pull: always
image: golang:1.16
commands:
- make release - make release
image: golang:1.17
name: build-all-binary
pull: always
when: when:
event: event:
- tag - tag
- image: plugins/github-release
- name: deploy-all-binary name: deploy-all-binary
pull: always pull: always
image: plugins/github-release
settings: settings:
api_key: api_key:
from_secret: github_release_api_key from_secret: github_release_api_key
@ -323,26 +293,24 @@ steps:
when: when:
event: event:
- tag - tag
trigger: trigger:
ref: ref:
- refs/tags/** - refs/tags/**
depends_on:
- testing
--- ---
depends_on:
- linux-amd64
- linux-arm64
- linux-arm
- release-binary
kind: pipeline kind: pipeline
name: notifications name: notifications
platform: platform:
os: linux
arch: amd64 arch: amd64
os: linux
steps: steps:
- name: manifest - image: plugins/manifest
name: manifest
pull: always pull: always
image: plugins/manifest
settings: settings:
ignore_missing: true ignore_missing: true
password: password:
@ -350,16 +318,7 @@ steps:
spec: docker/manifest.tmpl spec: docker/manifest.tmpl
username: username:
from_secret: docker_username from_secret: docker_username
trigger: trigger:
ref: ref:
- refs/heads/master - refs/heads/master
- refs/tags/** - refs/tags/**
depends_on:
- linux-amd64
- linux-arm64
- linux-arm
- release-binary
...

View File

@ -20,7 +20,7 @@ func main() {
} }
if _, err := os.Stat("/run/drone/env"); err == nil { if _, err := os.Stat("/run/drone/env"); err == nil {
godotenv.Overload("/run/drone/env") _ = godotenv.Overload("/run/drone/env")
} }
app := cli.NewApp() app := cli.NewApp()

View File

@ -9,7 +9,7 @@
steps: [ steps: [
{ {
name: 'vet', name: 'vet',
image: 'golang:1.16', image: 'golang:1.17',
pull: 'always', pull: 'always',
commands: [ commands: [
'make vet', 'make vet',
@ -23,7 +23,7 @@
}, },
{ {
name: 'lint', name: 'lint',
image: 'golang:1.16', image: 'golang:1.17',
pull: 'always', pull: 'always',
commands: [ commands: [
'make lint', 'make lint',
@ -37,7 +37,7 @@
}, },
{ {
name: 'misspell', name: 'misspell',
image: 'golang:1.16', image: 'golang:1.17',
pull: 'always', pull: 'always',
commands: [ commands: [
'make misspell-check', 'make misspell-check',
@ -51,7 +51,7 @@
}, },
{ {
name: 'test', name: 'test',
image: 'golang:1.16-alpine', image: 'golang:1.17-alpine',
pull: 'always', pull: 'always',
commands: [ commands: [
'apk add git make curl perl bash build-base zlib-dev ucl-dev', 'apk add git make curl perl bash build-base zlib-dev ucl-dev',
@ -93,7 +93,7 @@
steps: [ steps: [
{ {
name: 'build-push', name: 'build-push',
image: 'golang:1.16', image: 'golang:1.17',
pull: 'always', pull: 'always',
environment: { environment: {
CGO_ENABLED: '0', CGO_ENABLED: '0',
@ -109,7 +109,7 @@
}, },
{ {
name: 'build-tag', name: 'build-tag',
image: 'golang:1.16', image: 'golang:1.17',
pull: 'always', pull: 'always',
environment: { environment: {
CGO_ENABLED: '0', CGO_ENABLED: '0',
@ -123,7 +123,7 @@
}, },
{ {
name: 'executable', name: 'executable',
image: 'golang:1.16', image: 'golang:1.17',
pull: 'always', pull: 'always',
commands: [ commands: [
'./release/' + os + '/' + arch + '/' + name + ' --help', './release/' + os + '/' + arch + '/' + name + ' --help',
@ -188,7 +188,7 @@
steps: [ steps: [
{ {
name: 'build-all-binary', name: 'build-all-binary',
image: 'golang:1.16', image: 'golang:1.17',
pull: 'always', pull: 'always',
commands: [ commands: [
'make release' 'make release'