Skip to content

Commit

Permalink
Merge pull request #154 from acald-creator/upgrade/go/1.19
Browse files Browse the repository at this point in the history
Upgrade to Go 1.19
  • Loading branch information
leecalcote authored Oct 4, 2022
2 parents 9fd0c8b + e7b3b1e commit 99d2df7
Show file tree
Hide file tree
Showing 21 changed files with 365 additions and 922 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Meshery Adapter for NGINX Build and Releaser
name: Meshery-Nginx SM Build and Release
on:
push:
branches:
Expand All @@ -13,20 +13,20 @@ jobs:
# needs: [lint, error_check, static_check, vet, sec_check, tests]
steps:
- name: Check out code
uses: actions/checkout@master
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Setup Go
uses: actions/setup-go@v1
uses: actions/setup-go@v3
with:
go-version: 1.17
go-version: 1.19
- run: GOPROXY=direct GOSUMDB=off GO111MODULE=on go build .
docker:
name: Docker build and push
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Docker login
Expand Down
42 changes: 27 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,24 @@ jobs:
name: Check & Review code
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
fetch-depth: 1
- name: Setup Go
uses: actions/setup-go@v3
go-version: 1.19
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
go-version: 1.17
- run: GOPROXY=direct GOSUMDB=off go get -u golang.org/x/lint/golint; go list ./nginx/... | grep -v /vendor/ | xargs -L1 /home/runner/go/bin/golint -set_exit_status
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.49

# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
# args: --issues-exit-code=0

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true
error_check:
name: Error check
runs-on: ubuntu-latest
Expand All @@ -33,8 +42,8 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.17
- run: GOPROXY=direct GOSUMDB=off GO111MODULE=on go get -u github.com/kisielk/errcheck; /home/runner/go/bin/errcheck -tags draft ./...
go-version: 1.19
- run: GOPROXY=https://proxy.golang.org,direct GOSUMDB=off GO111MODULE=on go install github.com/kisielk/errcheck@latest; /home/runner/go/bin/errcheck -tags draft ./...
static_check:
name: Static check
runs-on: ubuntu-latest
Expand All @@ -46,8 +55,11 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.17
- run: GOPROXY=direct GOSUMDB=off GO111MODULE=on go get -u honnef.co/go/tools/cmd/staticcheck; /home/runner/go/bin/staticcheck -tags draft -checks all ./nginx/... # https://staticcheck.io/docs/checks
go-version: 1.19
- uses: dominikh/[email protected]
with:
install-go: false
version: "2022.1"
vet:
name: Vet
runs-on: ubuntu-latest
Expand All @@ -59,7 +71,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.17
go-version: 1.19
- run: GOPROXY=direct GOSUMDB=off GO111MODULE=on go vet -tags draft ./...
sec_check:
name: Security check
Expand Down Expand Up @@ -89,11 +101,11 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.17
go-version: 1.19
- name: Create cluster using KinD
uses: engineerd/setup-kind@v0.3.0
uses: engineerd/setup-kind@v0.5.0
with:
version: "v0.7.0"
version: "v0.11.0"
- run: |
export CURRENTCONTEXT="$(kubectl config current-context)"
echo "current-context:" ${CURRENTCONTEXT}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/e2etests.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test Nginx Adapter - control plane and addons
name: E2E Test Nginx SM Adapter - Control Plane and Addons

on:
push:
Expand All @@ -19,7 +19,7 @@ jobs:
adapter_version: ${{ env.version }}
steps:
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Get version of adapter
run: |
if [ ${{ github.event_name }} == "release" ];then
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
if [ "${{github.event_name }}" == "release" ];then
echo "version=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
fi
- uses: actions/checkout@master
- uses: actions/checkout@v3
with:
repository: meshery/meshery
token: ${{ secrets.GH_ACCESS_TOKEN }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/error-ref-publisher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ jobs:
if: github.repository == 'meshery/meshery-nginx-sm'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
# token here with write access to meshery-nginx-sm repo
with:
token: ${{ secrets.GH_ACCESS_TOKEN }}
ref: "master"

- name: Setup Go
uses: actions/setup-go@v1
uses: actions/setup-go@v3
with:
go-version: ${{ secrets.GO_VERSION }}

Expand All @@ -40,7 +40,7 @@ jobs:

# to push changes to meshery docs
- name: Checkout meshery
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: "meshery/meshery"
# token with write access to meshery repository
Expand All @@ -60,5 +60,5 @@ jobs:
commit_user_email: [email protected]
commit_author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
commit_options: '--signoff'
commit_message: '[Docs] Error Code Reference: Meshery Adapter for OSM updated'
commit_message: '[Docs] Error Code Reference: Meshery Adapter for NGINX Service Mesh updated'
file_pattern: docs/
4 changes: 2 additions & 2 deletions .github/workflows/label-commenter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ permissions:

jobs:
comment:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
ref: master # Set your default branch

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ jobs:

-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2
-
name: Docker Meta
id: meta
Expand All @@ -93,7 +93,7 @@ jobs:
type=raw,value=${{env.RELEASE_CHANNEL}}-latest
-
name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/update-oam-defs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
uses: actions/checkout@v3
with:
fetch-depth: 1
token: ${{ secrets.GH_ACCESS_TOKEN }}
ref: "master"
- name: Setup Go
uses: actions/setup-go@v1
uses: actions/setup-go@v3
with:
go-version: 1.17
go-version: 1.19
- name: Run adapter to create components
run: |
touch log.txt
Expand All @@ -40,5 +40,5 @@ jobs:
commit_user_email: [email protected]
commit_author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
commit_options: "--signoff"
commit_message: "[Patterns] Pattern components generated from latest Kuma Helm chart"
commit_message: "[Patterns] Pattern components generated from latest Nginx Service Mesh Helm chart"
branch: master
144 changes: 144 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
linters-settings:
depguard:
list-type: blacklist
packages:
# logging is allowed only by logutils.Log, logrus
# is allowed to use only in logutils package
- github.com/sirupsen/logrus
packages-with-error-message:
- github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
dupl:
threshold: 100
exhaustive:
default-signifies-exhaustive: false
funlen:
lines: 100
statements: 50
gci:
local-prefixes: github.com/golangci/golangci-lint
goconst:
min-len: 2
min-occurrences: 2
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- dupImport # https://github.com/go-critic/go-critic/issues/845
- ifElseChain
- octalLiteral
- whyNoLint
- wrapperFunc
gocyclo:
min-complexity: 15
goimports:
local-prefixes: github.com/golangci/golangci-lint
golint:
min-confidence: 0
gomnd:
settings:
mnd:
# don't include the "operation" and "assign"
checks: argument,case,condition,return
gosec:
settings:
exclude: -G204
govet:
check-shadowing: false
settings:
printf:
funcs:
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
lll:
line-length: 950
maligned:
suggest-new: true
misspell:
locale: US
nolintlint:
allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space)
allow-unused: false # report any unused nolint directives
require-explanation: false # don't require an explanation for nolint directives
require-specific: false # don't require nolint directives to be specific about which linter is being skipped

linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
# https://golangci-lint.run/usage/linters/
disable-all: true
enable:
# TODO: consider continuously if more should be enabled.
# Can also be useful to run with more strict settings before commit locally, i.e. to test for TODOs (godox)
# - bodyclose
# - deadcode
- dogsled
# - dupl
- errcheck
# - exhaustive
# - funlen
# - goconst
# - gocritic
# - gocyclo
- gofmt
- goimports
# - golint
- gomodguard
- gosec
# - gomnd
# - goprintffuncname
- gosimple
- govet
- ineffassign
# - interfacer
- lll
- misspell
# - nakedret
# - nolintlint
# - rowserrcheck
# - scopelint
- staticcheck
# - structcheck
- stylecheck
- typecheck
# - unconvert
# - unparam
- unused
# - varcheck
- whitespace
- asciicheck
# - gochecknoglobals
# - gocognit
# - godot
# - godox
# - goerr113
# - maligned
# - nestif
# - prealloc
# - testpackage
# - wsl

issues:
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
- path: _test\.go
linters:
- gomnd

# https://github.com/go-critic/go-critic/issues/926
- linters:
- gocritic
text: "unnecessaryDefer:"

run:
skip-dirs:
- test/testdata_etc
- internal/cache
- internal/renameio
- internal/robustio
timeout: 5m
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.17 as builder
FROM golang:1.19 as builder

ARG VERSION
ARG GIT_COMMITSHA
Expand Down
Loading

0 comments on commit 99d2df7

Please sign in to comment.