Skip to content

Commit

Permalink
Update to go1.16
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpollet authored Aug 8, 2021
1 parent 2f436ca commit 376b3dc
Show file tree
Hide file tree
Showing 13 changed files with 428 additions and 323 deletions.
2 changes: 1 addition & 1 deletion .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ global_job_config:
prologue:
commands:
- curl -sSfL https://raw.githubusercontent.com/ldez/semgo/master/godownloader.sh | sudo sh -s -- -b "/usr/local/bin"
- sudo semgo go1.15
- sudo semgo go1.16
- echo "${DOCKERHUB_PASSWORD}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin
- checkout

Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: go

go:
- 1.15.x
- 1.16.x

os: linux

Expand All @@ -22,7 +22,7 @@ cache:
jobs:
fast_finish: true
include:
- go: 1.15.x
- go: 1.16.x
env: STABLE=true

env:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.15-alpine AS base-image
FROM golang:1.16-alpine AS base-image

# Package dependencies
RUN apk --no-cache --no-progress add \
Expand Down
3 changes: 1 addition & 2 deletions cmd/loaders.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package cmd

import (
"fmt"
"io/ioutil"
"os"
"strings"

Expand Down Expand Up @@ -92,7 +91,7 @@ func (f *FileLoader) Load(args []string, cmd *cli.Command) (bool, error) {

logger.Printf("Configuration loaded from file: %s", configFile)

content, _ := ioutil.ReadFile(configFile)
content, _ := os.ReadFile(configFile)
logger.Debug(string(content))

return true, nil
Expand Down
20 changes: 10 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
module github.com/traefik/mesh

go 1.15
go 1.16

require (
github.com/cenkalti/backoff/v4 v4.0.2
github.com/cenkalti/backoff/v4 v4.1.0
github.com/go-check/check v0.0.0-20180628173108-788fd7840127
github.com/google/uuid v1.1.1
github.com/google/uuid v1.1.2
github.com/gorilla/mux v1.7.3
github.com/hashicorp/go-version v1.2.1
github.com/servicemeshinterface/smi-sdk-go v0.4.1
github.com/sirupsen/logrus v1.6.0
github.com/stretchr/testify v1.6.1
github.com/traefik/paerser v0.1.0
github.com/traefik/traefik/v2 v2.3.0
github.com/sirupsen/logrus v1.7.0
github.com/stretchr/testify v1.7.0
github.com/traefik/paerser v0.1.4
github.com/traefik/traefik/v2 v2.4.13
github.com/vdemeester/shakers v0.1.0
k8s.io/api v0.18.6
k8s.io/apimachinery v0.18.6
k8s.io/client-go v0.18.6
k8s.io/api v0.20.2
k8s.io/apimachinery v0.20.2
k8s.io/client-go v0.20.2
)

replace github.com/docker/docker => github.com/docker/engine v1.4.2-0.20200204220554-5f6d6f3f2203
Expand Down
676 changes: 390 additions & 286 deletions go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions integration/try/condition.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package try

import (
"fmt"
"io/ioutil"
"io"
"net/http"
"strings"
)
Expand Down Expand Up @@ -36,7 +36,7 @@ type ResponseCondition func(*http.Response) error
// strings.
func BodyContains(values ...string) ResponseCondition {
return func(res *http.Response) error {
body, err := ioutil.ReadAll(res.Body)
body, err := io.ReadAll(res.Body)
if err != nil {
return fmt.Errorf("failed to read response body: %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"time"

Expand Down Expand Up @@ -217,7 +217,7 @@ func (a *API) getMeshNodeConfiguration(w http.ResponseWriter, r *http.Request) {
}
}()

body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
a.log.Errorf("Unable to get configuration response body from pod %q: %v", pod.Name, err)
http.Error(w, "", http.StatusBadGateway)
Expand Down
14 changes: 7 additions & 7 deletions pkg/controller/portmapping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package controller
import (
"context"
"fmt"
"io/ioutil"
"io"
"testing"
"time"

Expand All @@ -22,7 +22,7 @@ import (

func TestPortMapping_AddEmptyState(t *testing.T) {
logger := logrus.New()
logger.SetOutput(ioutil.Discard)
logger.SetOutput(io.Discard)

serviceLister, err := newFakeServiceLister()
require.NoError(t, err)
Expand All @@ -45,7 +45,7 @@ func TestPortMapping_AddEmptyState(t *testing.T) {

func TestPortMapping_AddOverflow(t *testing.T) {
logger := logrus.New()
logger.SetOutput(ioutil.Discard)
logger.SetOutput(io.Discard)

serviceLister, err := newFakeServiceLister()
require.NoError(t, err)
Expand Down Expand Up @@ -83,7 +83,7 @@ func TestPortMapping_AddOverflow(t *testing.T) {

func TestPortMapping_FindWithState(t *testing.T) {
logger := logrus.New()
logger.SetOutput(ioutil.Discard)
logger.SetOutput(io.Discard)

serviceLister, err := newFakeServiceLister()
require.NoError(t, err)
Expand All @@ -103,7 +103,7 @@ func TestPortMapping_FindWithState(t *testing.T) {

func TestPortMapping_Remove(t *testing.T) {
logger := logrus.New()
logger.SetOutput(ioutil.Discard)
logger.SetOutput(io.Discard)

serviceLister, err := newFakeServiceLister()
require.NoError(t, err)
Expand Down Expand Up @@ -190,7 +190,7 @@ func TestPortMapping_LoadState(t *testing.T) {
for _, test := range tests {
t.Run(test.desc, func(t *testing.T) {
logger := logrus.New()
logger.SetOutput(ioutil.Discard)
logger.SetOutput(io.Discard)

serviceLister, err := newFakeServiceLister(test.services...)
require.NoError(t, err)
Expand Down Expand Up @@ -234,7 +234,7 @@ func TestPortMapping_parseServiceNamespaceAndName(t *testing.T) {
for _, test := range tests {
t.Run(test.desc, func(t *testing.T) {
logger := logrus.New()
logger.SetOutput(ioutil.Discard)
logger.SetOutput(io.Discard)

serviceLister, err := newFakeServiceLister()
require.NoError(t, err)
Expand Down
4 changes: 2 additions & 2 deletions pkg/k8s/client_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package k8s

import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"regexp"
"strings"
Expand Down Expand Up @@ -56,7 +56,7 @@ type ClientMock struct {

// NewClientMock create a new client mock.
func NewClientMock(testingT *testing.T, path string) *ClientMock {
yamlContent, err := ioutil.ReadFile(filepath.FromSlash("./testdata/" + path))
yamlContent, err := os.ReadFile(filepath.FromSlash("./testdata/" + path))
if err != nil {
panic(err)
}
Expand Down
9 changes: 5 additions & 4 deletions pkg/provider/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package provider

import (
"encoding/json"
"io/ioutil"
"io"
"os"
"testing"

"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -134,7 +135,7 @@ func TestProvider_BuildConfig(t *testing.T) {
for _, test := range tests {
t.Run(test.desc, func(t *testing.T) {
logger := logrus.New()
logger.SetOutput(ioutil.Discard)
logger.SetOutput(io.Discard)

defaultTrafficType := "http"
if test.defaultTrafficType != "" {
Expand Down Expand Up @@ -181,7 +182,7 @@ func TestProvider_BuildConfig(t *testing.T) {
}

func loadTopology(filename string) (*topology.Topology, error) {
data, err := ioutil.ReadFile(filename)
data, err := os.ReadFile(filename)
if err != nil {
return nil, err
}
Expand All @@ -196,7 +197,7 @@ func loadTopology(filename string) (*topology.Topology, error) {
}

func assertConfig(t *testing.T, filename string, got *dynamic.Configuration) {
data, err := ioutil.ReadFile(filename)
data, err := os.ReadFile(filename)
require.NoError(t, err)

var want dynamic.Configuration
Expand Down
7 changes: 4 additions & 3 deletions pkg/topology/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"os"
"sort"
"strings"
"testing"
Expand Down Expand Up @@ -688,7 +689,7 @@ func createBuilder(k8sClient k8s.Interface, smiAccessClient accessclient.Interfa
}

logger := logrus.New()
logger.SetOutput(ioutil.Discard)
logger.SetOutput(io.Discard)

return &Builder{
serviceLister: svcLister,
Expand Down Expand Up @@ -919,7 +920,7 @@ func createServiceAccount(namespace, name string) *corev1.ServiceAccount {
}

func assertTopology(t *testing.T, filename string, got *Topology) {
data, err := ioutil.ReadFile(filename)
data, err := os.ReadFile(filename)
require.NoError(t, err)

var want Topology
Expand Down
2 changes: 1 addition & 1 deletion tmpl.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.15-alpine AS builder
FROM golang:1.16-alpine AS builder

# Package dependencies
RUN apk --no-cache --no-progress add \
Expand Down

0 comments on commit 376b3dc

Please sign in to comment.