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

build with go1.19.2 - new linters changes/fixes - dep updates, incl. security fixes #630

Merged
merged 4 commits into from Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Expand Up @@ -8,7 +8,7 @@ defaultEnv:
&defaultEnv
docker:
# specify the version
- image: docker.io/fortio/fortio.build:v46
- image: docker.io/fortio/fortio.build:v47
working_directory: /go/src/fortio.org/fortio

jobs:
Expand Down
4 changes: 4 additions & 0 deletions .golangci.yml
Expand Up @@ -86,6 +86,10 @@ linters:
- golint
- interfacer
- maligned
- varcheck
- structcheck
- nosnakecase
- deadcode
# Weird/bad ones:
- wsl
- nlreturn
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
@@ -1,5 +1,5 @@
# Build the binaries in larger image
FROM docker.io/fortio/fortio.build:v46 as build
FROM docker.io/fortio/fortio.build:v47 as build
WORKDIR /go/src/fortio.org
COPY . fortio
ARG MODE=install
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.build
@@ -1,5 +1,5 @@
# Dependencies and linters for build:
FROM golang:1.18.6
FROM golang:1.19.2
# Need gcc for -race test (and some linters though those work with CGO_ENABLED=0)
RUN apt-get -y update && \
apt-get --no-install-recommends -y upgrade && \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.echosrv
@@ -1,5 +1,5 @@
# Build the binaries in larger image
FROM docker.io/fortio/fortio.build:v46 as build
FROM docker.io/fortio/fortio.build:v47 as build
WORKDIR /go/src/fortio.org
COPY . fortio
RUN make -C fortio official-build-version BUILD_DIR=/build OFFICIAL_TARGET=fortio.org/fortio/echosrv OFFICIAL_BIN=../echosrv.bin
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.fcurl
@@ -1,5 +1,5 @@
# Build the binaries in larger image
FROM docker.io/fortio/fortio.build:v46 as build
FROM docker.io/fortio/fortio.build:v47 as build
WORKDIR /go/src/fortio.org
COPY . fortio
# fcurl should not need vendor/no dependencies
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -7,7 +7,7 @@
IMAGES=echosrv fcurl # plus the combo image / Dockerfile without ext.

DOCKER_PREFIX := docker.io/fortio/fortio
BUILD_IMAGE_TAG := v46
BUILD_IMAGE_TAG := v47
BUILDX_PLATFORMS := linux/amd64,linux/arm64,linux/ppc64le,linux/s390x
BUILDX_POSTFIX :=
ifeq '$(shell echo $(BUILDX_PLATFORMS) | awk -F "," "{print NF-1}")' '0'
Expand Down
2 changes: 1 addition & 1 deletion Webtest.sh
Expand Up @@ -125,7 +125,7 @@ fi
PPROF_URL="$BASE_URL/debug/pprof/heap?debug=1"
$CURL "$PPROF_URL" | grep -i TotalAlloc # should find this in memory profile
# creating dummy container to hold a volume for test certs due to remote docker bind mount limitation.
DOCKERCURLID=$(docker run -d -v $TEST_CERT_VOL --net host --name $DOCKERSECVOLNAME docker.io/fortio/fortio.build:v46 sleep 120)
DOCKERCURLID=$(docker run -d -v $TEST_CERT_VOL --net host --name $DOCKERSECVOLNAME docker.io/fortio/fortio.build:v47 sleep 120)
# while we have something with actual curl binary do
# Test for h2c upgrade (#562)
docker exec $DOCKERSECVOLNAME /usr/bin/curl -v --http2 -m 10 -d foo42 http://localhost:8080/debug | tee >(cat 1>&2) | grep foo42
Expand Down
2 changes: 1 addition & 1 deletion dflag/configmap/updater_test.go
Expand Up @@ -73,7 +73,7 @@ func (s *updaterTestSuite) linkDataDirTo(newDataDir string) {
copyCmd := exec.Command("ln", "-s", "-n", "-f",
path.Join(s.tempDir, "testdata", newDataDir),
path.Join(s.tempDir, "testdata", "..data"))
assert.NoError(s.T(), copyCmd.Run(), "relinking ..data in tempdir tempdir must not fail")
assert.NoError(s.T(), copyCmd.Run(), "relinking ..data in tempdir must not fail")
}

func (s *updaterTestSuite) TestInitializeFailsOnBadFormedFlag() {
Expand Down
2 changes: 0 additions & 2 deletions fhttp/http_forwarder.go
Expand Up @@ -118,10 +118,8 @@ func (mcfg *MultiServerConfig) TeeHandler(w http.ResponseWriter, r *http.Request
}
r.Body.Close()
if mcfg.Serial {
//nolint:contextcheck // bug I think as we transfer the context - asked in https://github.com/kkHAIKE/contextcheck/issues/3
mcfg.TeeSerialHandler(w, r, data)
} else {
//nolint:contextcheck // bug I think as we transfer the context - asked in https://github.com/kkHAIKE/contextcheck/issues/3
mcfg.TeeParallelHandler(w, r, data)
}
}
Expand Down
2 changes: 1 addition & 1 deletion fhttp/http_server.go
Expand Up @@ -428,7 +428,6 @@ func FetcherHandler2(w http.ResponseWriter, r *http.Request) {
if !strings.HasPrefix(url, "http://") && !strings.HasPrefix(url, "https://") {
url = "http://" + url
}
//nolint:contextcheck // bug(?) we transfer the context from the http request https://github.com/kkHAIKE/contextcheck/issues/3
req := MakeSimpleRequest(url, r, fetch2CopiesAllHeader.Get())
if req == nil {
http.Error(w, "parsing url failed, invalid url", http.StatusBadRequest)
Expand Down Expand Up @@ -478,6 +477,7 @@ func FetcherHandler(w http.ResponseWriter, r *http.Request) {
opts := NewHTTPOptions("http://" + url)
opts.HTTPReqTimeOut = 5 * time.Minute
OnBehalfOf(opts, r)
//nolint:contextcheck // TODO: yes we should plug an aborter in the http options that's based on this request's context.
client, _ := NewClient(opts)
if client == nil {
return // error logged already
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -14,7 +14,7 @@ require (

require (
golang.org/x/sys v0.0.0-20220908164124-27713097b956 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/text v0.3.8 // indirect
google.golang.org/genproto v0.0.0-20220714211235-042d03aeabc9 // indirect
google.golang.org/protobuf v1.28.0 // indirect
)
4 changes: 2 additions & 2 deletions go.sum
Expand Up @@ -15,8 +15,8 @@ golang.org/x/net v0.0.0-20220708220712-1185a9018129 h1:vucSRfWwTsoXro7P+3Cjlr6fl
golang.org/x/net v0.0.0-20220708220712-1185a9018129/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/sys v0.0.0-20220908164124-27713097b956 h1:XeJjHH1KiLpKGb6lvMiksZ9l0fVUh+AmGcm0nOMEBOY=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY=
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/genproto v0.0.0-20220714211235-042d03aeabc9 h1:zfXhTgBfGlIh3jMXN06W8qbhFGsh6MJNJiYEuhTddOI=
google.golang.org/genproto v0.0.0-20220714211235-042d03aeabc9/go.mod h1:GkXuJDJ6aQ7lnJcRF+SJVgFdQhypqgl3LB1C9vabdRE=
Expand Down
2 changes: 1 addition & 1 deletion rapi/data.go
Expand Up @@ -132,7 +132,7 @@ func sendHTMLDataIndex(w http.ResponseWriter) {
}

// GetDataURL gives the url of the data/ dir either using configured `-base-url` and ui path
// from from the incoming Host header.
// from the incoming Host header.
func GetDataURL(r *http.Request) string {
// Ingress effect / baseURL support:
url := baseURL
Expand Down
2 changes: 1 addition & 1 deletion release/Dockerfile.in
@@ -1,5 +1,5 @@
# Concatenated after ../Dockerfile to create the tgz
FROM docker.io/fortio/fortio.build:v46 as stage
FROM docker.io/fortio/fortio.build:v47 as stage
ARG archs="amd64 arm64 ppc64le s390x"
ENV archs=${archs}
# Build image defaults to build user, switch back to root for
Expand Down
2 changes: 1 addition & 1 deletion release/README.md
Expand Up @@ -43,7 +43,7 @@ Make sure it gets successfully pushed to the fortio registry (requires org acces
run

```Shell
make update-build-image-tag
make update-build-image-tag SED=gsed
```

Check the diff and make lint, webtest, etc and PR
Expand Down
1 change: 1 addition & 0 deletions tcprunner/tcprunner.go
Expand Up @@ -103,6 +103,7 @@ var (
// GeneratePayload generates a default 24 bytes unique payload for each runner thread and message sent
// when no other payload is set.
func GeneratePayload(t int, i int64) []byte {
//nolint:dupword
// up to 9999 connections and 999 999 999 999 (999B) request
s := fmt.Sprintf("Fortio\n%04d\n%012d", t, i) // 6+2+4+12 = 24 bytes
return []byte(s)
Expand Down