Skip to content

Commit

Permalink
[build] Use go 1.18 (m3db#4107)
Browse files Browse the repository at this point in the history
  • Loading branch information
vdarulis authored Apr 29, 2022
1 parent 2bd4bf0 commit 27625ca
Show file tree
Hide file tree
Showing 188 changed files with 760 additions and 690 deletions.
10 changes: 5 additions & 5 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ steps:
command: make clean install-vendor-m3 test-all-gen
env:
CGO_ENABLED: 0
GIMME_GO_VERSION: 1.16.x
GIMME_GO_VERSION: 1.18.x
plugins:
gopath-checkout#v1.0.1:
import: github.com/m3db/m3
Expand Down Expand Up @@ -60,7 +60,7 @@ steps:
parallelism: 2
env:
CGO_ENABLED: 0
GIMME_GO_VERSION: 1.16.x
GIMME_GO_VERSION: 1.18.x
plugins:
gopath-checkout#v1.0.1:
import: github.com/m3db/m3
Expand All @@ -69,7 +69,7 @@ steps:
command: make clean test-ci-cluster-integration
env:
CGO_ENABLED: 0
GIMME_GO_VERSION: 1.16.x
GIMME_GO_VERSION: 1.18.x
plugins:
gopath-checkout#v1.0.1:
import: github.com/m3db/m3
Expand All @@ -87,7 +87,7 @@ steps:
parallelism: 1
env:
CGO_ENABLED: 0
GIMME_GO_VERSION: 1.16.x
GIMME_GO_VERSION: 1.18.x
plugins:
gopath-checkout#v1.0.1:
import: github.com/m3db/m3
Expand Down Expand Up @@ -136,7 +136,7 @@ steps:
command: make clean install-vendor-m3 docs-test
env:
CGO_ENABLED: 0
GIMME_GO_VERSION: 1.16.x
GIMME_GO_VERSION: 1.18.x
plugins:
gopath-checkout#v1.0.1:
import: github.com/m3db/m3
Expand Down
42 changes: 30 additions & 12 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ linters-settings:
govet:
# report about shadowed variables
check-shadowing: true
goimports:
# put imports beginning with prefix after 3rd-party packages;
# it's a comma-separated list of prefixes
local-prefixes: github.com/m3db/m3
maligned:
# print struct with more effective memory layout or not, false by default
suggest-new: true
Expand Down Expand Up @@ -161,15 +157,19 @@ linters-settings:
- hugeParam
- rangeValCopy
enabled-checks:
- ruleguard
# temp disabled, something wrong on go 1.18
# - ruleguard
settings: # settings passed to gocritic
captLocal: # must be valid enabled check name
paramsOnly: true
ruleguard:
rules: "src/cmd/tools/linter/gorules/rules.go"
# ruleguard:
# rules: "src/cmd/tools/linter/gorules/rules.go"
gci:
# gci control golang package import order and make it always deterministic
local-prefixes: github.com/m3db/m3
sections:
- standard
- prefix(github.com/m3db/m3)
- default

linters:
enable:
Expand All @@ -180,7 +180,6 @@ linters:
- gci
- goconst
- gocritic
- goimports
- golint
- gosimple
- govet
Expand Down Expand Up @@ -216,16 +215,16 @@ linters:
- interfacer
# Valid use for not explicitly setting every field when they are optional nil/empty.
- exhaustivestruct
# We allow cuddling assignment following conditions because there are valid
# We allow cuddling assignment following conditions because there are valid
# logical groupings for this use-case (e.g. when evaluating config values).
- wsl
- wsl
# Wrapcheck can cause errors until all callsites checking explicit error
# types like io.EOF are converted to use errors.Is instead. Re-enable this
# linter once all error checks are upgraded.
- wrapcheck
# godox prevents using TODOs or FIXMEs which can be useful for demarkation
# of future work.
- godox
- godox
# New line required before return would require a large fraction of the
# code base to need updating, it's not worth the perceived benefit.
- nlreturn
Expand All @@ -237,6 +236,23 @@ linters:
- gocyclo
# Doesn't buy us much being super opinionated on how to name test functions.
- thelper
# Useless, fails pretty much every file.
- varnamelen
# Accept interfaces, return structs is a geat mantra that's too late to adopt.
- ireturn
# Not a problem worthy enough to change lots of code. Also has a section named `What if I think it's bullshit?` in README.md
- nilnil
# Wants yaml tags to look like `perCpu` vs `perCPU`.
- tagliatelle
# There are valid uses for context in structs.
- containedctx
# These are new and flag a lot, need a separate evaluation:
- forcetypeassert
- errname
- promlinter
- gomoddirectives
- gofumpt
- ifshort
disable-all: false
presets:
# bodyclose, errcheck, gosec, govet, scopelint, staticcheck, typecheck
Expand Down Expand Up @@ -280,6 +296,8 @@ issues:
# The errcheck linter already checks for unhandled errors so we can disable the equivalent
# lint by gosec.
- "G104: Errors unhandled"
# Random numbers here are not used in a security-sensitive context.
- "G404: Use of weak random number generator (math/rand instead of crypto/rand)"

# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM golang:1.16-stretch
FROM golang:1.18-stretch

RUN apt-get update && apt-get install -y lsof
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ GO_BUILD_LDFLAGS_CMD := $(abspath ./scripts/go-build-ldflags.sh)
GO_BUILD_LDFLAGS := $(shell $(GO_BUILD_LDFLAGS_CMD) LDFLAG)
GO_BUILD_COMMON_ENV := CGO_ENABLED=0
LINUX_AMD64_ENV := GOOS=linux GOARCH=amd64 $(GO_BUILD_COMMON_ENV)
# GO_RELEASER_DOCKER_IMAGE is latest goreleaser for go 1.16
GO_RELEASER_DOCKER_IMAGE := goreleaser/goreleaser:v0.173.2
# GO_RELEASER_DOCKER_IMAGE is latest goreleaser for go 1.18
GO_RELEASER_DOCKER_IMAGE := goreleaser/goreleaser:v1.8.3
GO_RELEASER_RELEASE_ARGS ?= --rm-dist
GO_RELEASER_WORKING_DIR := /go/src/github.com/m3db/m3
GOLANGCI_LINT_VERSION := v1.37.0
GOLANGCI_LINT_VERSION := v1.45.2

export NPROC := 2 # Maximum package concurrency for unit tests.

Expand Down
4 changes: 2 additions & 2 deletions docker/m3aggregator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# stage 1: build
FROM golang:1.16.5-alpine3.13 AS builder
FROM golang:1.18-alpine3.15 AS builder
LABEL maintainer="The M3DB Authors <[email protected]>"

# Install deps
Expand All @@ -15,7 +15,7 @@ RUN cd /go/src/github.com/m3db/m3/ && \
make m3aggregator-linux-amd64

# stage 2: lightweight "release"
FROM alpine:3.11
FROM alpine:3.15
LABEL maintainer="The M3DB Authors <[email protected]>"

EXPOSE 5000/tcp 6000/tcp 6001/tcp
Expand Down
4 changes: 2 additions & 2 deletions docker/m3coordinator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# stage 1: build
FROM golang:1.16.5-alpine3.13 AS builder
FROM golang:1.18-alpine3.15 AS builder
LABEL maintainer="The M3DB Authors <[email protected]>"

# Install deps
Expand All @@ -15,7 +15,7 @@ RUN cd /go/src/github.com/m3db/m3/ && \
make m3coordinator-linux-amd64

# stage 2: lightweight "release"
FROM alpine:3.11
FROM alpine:3.14
LABEL maintainer="The M3DB Authors <[email protected]>"

# Provide timezone data to allow TZ environment variable to be set
Expand Down
4 changes: 2 additions & 2 deletions docker/m3dbnode/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# stage 1: build
FROM golang:1.16.5-alpine3.13 AS builder
FROM golang:1.18-alpine3.15 AS builder
LABEL maintainer="The M3DB Authors <[email protected]>"

# Install deps
Expand All @@ -15,7 +15,7 @@ RUN cd /go/src/github.com/m3db/m3/ && \
make m3dbnode-linux-amd64

# Stage 2: lightweight "release"
FROM alpine:3.11
FROM alpine:3.15
LABEL maintainer="The M3DB Authors <[email protected]>"

ENV GODEBUG madvdontneed=1
Expand Down
4 changes: 2 additions & 2 deletions docker/m3dbnode/Dockerfile-setcap
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# stage 1: build
FROM golang:1.16.5-alpine3.13 AS builder
FROM golang:1.18-alpine3.15 AS builder
LABEL maintainer="The M3DB Authors <[email protected]>"

# Install deps
Expand All @@ -15,7 +15,7 @@ RUN cd /go/src/github.com/m3db/m3/ && \
make m3dbnode-linux-amd64

# Stage 2: lightweight "release"
FROM alpine:3.11
FROM alpine:3.15
LABEL maintainer="The M3DB Authors <[email protected]>"

ENV GODEBUG madvdontneed=1
Expand Down
4 changes: 2 additions & 2 deletions docker/m3query/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# stage 1: build
FROM golang:1.16.5-alpine3.13 AS builder
FROM golang:1.18-alpine3.15 AS builder
LABEL maintainer="The M3DB Authors <[email protected]>"

# Install deps
Expand All @@ -15,7 +15,7 @@ RUN cd /go/src/github.com/m3db/m3/ && \
make m3query-linux-amd64

# stage 2: lightweight "release"
FROM alpine:3.11
FROM alpine:3.15
LABEL maintainer="The M3DB Authors <[email protected]>"

EXPOSE 7201/tcp 7203/tcp
Expand Down
Loading

0 comments on commit 27625ca

Please sign in to comment.