Skip to content

Commit 8874415

Browse files
committed
update to go1.18.9, gofmt, and regenerate proto
some of the "go get" installs now expect a newer version of Go, and we want the version to match the version in the 20.10 branch in moby, which is what this repository is used for. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 9ed130d commit 8874415

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+111
-69
lines changed

Dockerfile

+12-10
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
1-
ARG GO_VERSION=1.13.8
1+
ARG GO_VERSION=1.18.9
22

33
FROM golang:${GO_VERSION}-buster as dev
44
RUN apt-get update && apt-get -y install iptables \
55
protobuf-compiler
66

7-
RUN go get -d github.com/gogo/protobuf/protoc-gen-gogo && \
8-
cd /go/src/github.com/gogo/protobuf/protoc-gen-gogo && \
9-
git reset --hard 30cf7ac33676b5786e78c746683f0d4cd64fa75b && \
10-
go install
7+
RUN git clone https://github.com/gogo/protobuf.git /go/src/github.com/gogo/protobuf \
8+
&& cd /go/src/github.com/gogo/protobuf/protoc-gen-gogo \
9+
&& git reset --hard 30cf7ac33676b5786e78c746683f0d4cd64fa75b \
10+
&& GO111MODULE=off go install
1111

12-
RUN go get golang.org/x/lint/golint \
13-
golang.org/x/tools/cmd/cover \
14-
github.com/mattn/goveralls \
15-
github.com/gordonklaus/ineffassign \
16-
github.com/client9/misspell/cmd/misspell
12+
RUN go install golang.org/x/lint/golint@latest \
13+
&& go install golang.org/x/tools/cmd/cover@latest \
14+
&& go install github.com/mattn/goveralls@latest \
15+
&& go install github.com/gordonklaus/ineffassign@latest \
16+
&& go install github.com/client9/misspell/cmd/misspell@latest
1717

1818
WORKDIR /go/src/github.com/docker/libnetwork
19+
ENV GO111MODULE=off
20+
1921

2022
FROM dev
2123

Makefile

+5-5
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ build: builder
4545
build-local:
4646
@echo "🐳 $@"
4747
@mkdir -p "bin"
48-
go build -tags experimental -o "bin/dnet" ./cmd/dnet
49-
go build -o "bin/docker-proxy" ./cmd/proxy
48+
GO111MODULE=off go build -tags experimental -o "bin/dnet" ./cmd/dnet
49+
GO111MODULE=off go build -o "bin/docker-proxy" ./cmd/proxy
5050
CGO_ENABLED=0 go build -o "bin/diagnosticClient" ./cmd/diagnostic
5151
CGO_ENABLED=0 go build -o "bin/testMain" ./cmd/networkdb-test/testMain.go
5252

@@ -82,8 +82,8 @@ cross: builder
8282

8383
cross-local:
8484
@echo "🐳 $@"
85-
go build -o "bin/dnet-$$GOOS-$$GOARCH" ./cmd/dnet
86-
go build -o "bin/docker-proxy-$$GOOS-$$GOARCH" ./cmd/proxy
85+
GO111MODULE=off go build -o "bin/dnet-$$GOOS-$$GOARCH" ./cmd/dnet
86+
GO111MODULE=off go build -o "bin/docker-proxy-$$GOOS-$$GOARCH" ./cmd/proxy
8787

8888
# Rebuild protocol buffers.
8989
# These may need to be rebuilt after vendoring updates, so .proto files are declared .PHONY so they are always rebuilt.
@@ -125,7 +125,7 @@ unit-tests: builder
125125
unit-tests-local:
126126
@echo "🐳 Running tests... "
127127
@echo "mode: count" > coverage.coverprofile
128-
@go build -o "bin/docker-proxy" ./cmd/proxy
128+
@GO111MODULE=off go build -o "bin/docker-proxy" ./cmd/proxy
129129
@for dir in $$( find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -not -path './vendor/*' -type d); do \
130130
if ls $$dir/*.go &> /dev/null; then \
131131
pushd . &> /dev/null ; \

api/api.go

+6
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ func processCreateDefaults(c libnetwork.NetworkController, nc *networkCreate) {
278278
/***************************
279279
NetworkController interface
280280
****************************/
281+
281282
func procCreateNetwork(c libnetwork.NetworkController, vars map[string]string, body []byte) (interface{}, *responseStatus) {
282283
var create networkCreate
283284

@@ -385,6 +386,7 @@ func procCreateSandbox(c libnetwork.NetworkController, vars map[string]string, b
385386
/******************
386387
Network interface
387388
*******************/
389+
388390
func procCreateEndpoint(c libnetwork.NetworkController, vars map[string]string, body []byte) (interface{}, *responseStatus) {
389391
var ec endpointCreate
390392

@@ -483,6 +485,7 @@ func procDeleteNetwork(c libnetwork.NetworkController, vars map[string]string, b
483485
/******************
484486
Endpoint interface
485487
*******************/
488+
486489
func procJoinEndpoint(c libnetwork.NetworkController, vars map[string]string, body []byte) (interface{}, *responseStatus) {
487490
var ej endpointJoin
488491
var setFctList []libnetwork.EndpointOption
@@ -561,6 +564,7 @@ func procDeleteEndpoint(c libnetwork.NetworkController, vars map[string]string,
561564
/******************
562565
Service interface
563566
*******************/
567+
564568
func procGetServices(c libnetwork.NetworkController, vars map[string]string, body []byte) (interface{}, *responseStatus) {
565569
// Look for query filters and validate
566570
nwName, filterByNwName := vars[urlNwName]
@@ -734,6 +738,7 @@ func procDetachBackend(c libnetwork.NetworkController, vars map[string]string, b
734738
/******************
735739
Sandbox interface
736740
*******************/
741+
737742
func procGetSandbox(c libnetwork.NetworkController, vars map[string]string, body []byte) (interface{}, *responseStatus) {
738743
if epT, ok := vars[urlEpID]; ok {
739744
sv, errRsp := findService(c, epT, byID)
@@ -816,6 +821,7 @@ func procDeleteSandbox(c libnetwork.NetworkController, vars map[string]string, b
816821
/***********
817822
Utilities
818823
************/
824+
819825
const (
820826
byID = iota
821827
byName

bitseq/sequence.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -621,13 +621,14 @@ func findSequence(head *sequence, bytePos uint64) (*sequence, *sequence, uint64,
621621
// Remove current sequence if empty.
622622
// Check if new sequence can be merged with neighbour (previous/next) sequences.
623623
//
624-
//
625624
// Identify "current" sequence containing block:
626-
// [prev seq] [current seq] [next seq]
625+
//
626+
// [prev seq] [current seq] [next seq]
627627
//
628628
// Based on block position, resulting list of sequences can be any of three forms:
629629
//
630-
// block position Resulting list of sequences
630+
// block position Resulting list of sequences
631+
//
631632
// A) block is first in current: [prev seq] [new] [modified current seq] [next seq]
632633
// B) block is last in current: [prev seq] [modified current seq] [new] [next seq]
633634
// C) block is in the middle of current: [prev seq] [curr pre] [new] [curr post] [next seq]

client/types.go

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ type SandboxResource struct {
3131
/***********
3232
Body types
3333
************/
34+
3435
type ipamConf struct {
3536
PreferredPool string
3637
SubPool string

datastore/datastore.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"github.com/docker/libnetwork/types"
1515
)
1616

17-
//DataStore exported
17+
// DataStore exported
1818
type DataStore interface {
1919
// GetObject gets data from datastore and unmarshals to the specified object
2020
GetObject(key string, o KVObject) error
@@ -174,14 +174,14 @@ func (cfg *ScopeCfg) IsValid() bool {
174174
return true
175175
}
176176

177-
//Key provides convenient method to create a Key
177+
// Key provides convenient method to create a Key
178178
func Key(key ...string) string {
179179
keychain := append(rootChain, key...)
180180
str := strings.Join(keychain, "/")
181181
return str + "/"
182182
}
183183

184-
//ParseKey provides convenient method to unpack the key to complement the Key function
184+
// ParseKey provides convenient method to unpack the key to complement the Key function
185185
func ParseKey(key string) ([]string, error) {
186186
chain := strings.Split(strings.Trim(key, "/"), "/")
187187

drivers/bridge/bridge.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -781,8 +781,8 @@ func (d *driver) createNetwork(config *networkConfiguration) (err error) {
781781
// Setup IP6Tables.
782782
{config.EnableIPv6 && d.config.EnableIP6Tables, network.setupIP6Tables},
783783

784-
//We want to track firewalld configuration so that
785-
//if it is started/reloaded, the rules can be applied correctly
784+
// We want to track firewalld configuration so that
785+
// if it is started/reloaded, the rules can be applied correctly
786786
{d.config.EnableIPTables, network.setupFirewalld},
787787
// same for IPv6
788788
{config.EnableIPv6 && d.config.EnableIP6Tables, network.setupFirewalld6},
@@ -796,7 +796,7 @@ func (d *driver) createNetwork(config *networkConfiguration) (err error) {
796796
// Add inter-network communication rules.
797797
{d.config.EnableIPTables, setupNetworkIsolationRules},
798798

799-
//Configure bridge networking filtering if ICC is off and IP tables are enabled
799+
// Configure bridge networking filtering if ICC is off and IP tables are enabled
800800
{!config.EnableICC && d.config.EnableIPTables, setupBridgeNetFiltering},
801801
} {
802802
if step.Condition {

drivers/bridge/netlink_deprecated_linux_rawsockaddr_data_int8.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build !arm && !ppc64 && !ppc64le && !riscv64
12
// +build !arm,!ppc64,!ppc64le,!riscv64
23

34
package bridge

drivers/bridge/netlink_deprecated_linux_rawsockaddr_data_uint8.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build arm || ppc64 || ppc64le || riscv64
12
// +build arm ppc64 ppc64le riscv64
23

34
package bridge

drivers/bridge/netlink_deprecated_unsupported.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build !linux
12
// +build !linux
23

34
package bridge

drivers/bridge/setup_bridgenetfiltering.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const (
2020
ipvboth
2121
)
2222

23-
//Gets the IP version in use ( [ipv4], [ipv6] or [ipv4 and ipv6] )
23+
// Gets the IP version in use ( [ipv4], [ipv6] or [ipv4 and ipv6] )
2424
func getIPVersion(config *networkConfiguration) ipVersion {
2525
ipVersion := ipv4
2626
if config.AddressIPv6 != nil || config.EnableIPv6 {
@@ -49,7 +49,7 @@ func setupBridgeNetFiltering(config *networkConfiguration, i *bridgeInterface) e
4949
return nil
5050
}
5151

52-
//Enable bridge net filtering if ip forwarding is enabled. See github issue #11404
52+
// Enable bridge net filtering if ip forwarding is enabled. See github issue #11404
5353
func checkBridgeNetFiltering(config *networkConfiguration, i *bridgeInterface) error {
5454
ipVer := getIPVersion(config)
5555
iface := config.BridgeName
@@ -119,7 +119,7 @@ func getBridgeNFKernelParam(ipVer ipVersion) string {
119119
}
120120
}
121121

122-
//Gets the value of the kernel parameters located at the given path
122+
// Gets the value of the kernel parameters located at the given path
123123
func getKernelBoolParam(path string) (bool, error) {
124124
enabled := false
125125
line, err := ioutil.ReadFile(path)
@@ -132,7 +132,7 @@ func getKernelBoolParam(path string) (bool, error) {
132132
return enabled, err
133133
}
134134

135-
//Sets the value of the kernel parameter located at the given path
135+
// Sets the value of the kernel parameter located at the given path
136136
func setKernelBoolParam(path string, on bool) error {
137137
value := byte('0')
138138
if on {
@@ -141,7 +141,7 @@ func setKernelBoolParam(path string, on bool) error {
141141
return ioutil.WriteFile(path, []byte{value, '\n'}, 0644)
142142
}
143143

144-
//Checks to see if packet forwarding is enabled
144+
// Checks to see if packet forwarding is enabled
145145
func isPacketForwardingEnabled(ipVer ipVersion, iface string) (bool, error) {
146146
switch ipVer {
147147
case ipv4, ipv6:

drivers/bridge/setup_ip_tables.go

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const (
2222
// bridge. A positive match identifies a packet originated from one bridge
2323
// network's bridge destined to another bridge network's bridge and will
2424
// result in the packet being dropped. No match returns to the parent chain.
25+
2526
IsolationChain1 = "DOCKER-ISOLATION-STAGE-1"
2627
IsolationChain2 = "DOCKER-ISOLATION-STAGE-2"
2728
)

drivers/overlay/ostweaks_unsupported.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build !linux
12
// +build !linux
23

34
package overlay

drivers/windows/port_mapping.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build windows
12
// +build windows
23

34
package windows

drivers/windows/windows.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build windows
12
// +build windows
23

34
// Shim for the Host Network Service (HNS) to manage networking for

drivers/windows/windows_store.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build windows
12
// +build windows
23

34
package windows

drivers/windows/windows_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build windows
12
// +build windows
23

34
package windows

endpoint_info_unix.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build !windows
12
// +build !windows
23

34
package libnetwork

endpoint_info_windows.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build windows
12
// +build windows
23

34
package libnetwork

endpoint_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build !windows
12
// +build !windows
23

34
package libnetwork

firewall_others.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build !linux
12
// +build !linux
23

34
package libnetwork

ipams/builtin/builtin_unix.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build linux || freebsd || darwin
12
// +build linux freebsd darwin
23

34
package builtin

ipams/builtin/builtin_windows.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build windows
12
// +build windows
23

34
package builtin

ipams/remote/api/api.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ func (capRes GetCapabilityResponse) ToCapability() *ipamapi.Capability {
3434
}
3535
}
3636

37-
// GetAddressSpacesResponse is the response to the ``get default address spaces`` request message
37+
// GetAddressSpacesResponse is the response to the get default address spaces request message
3838
type GetAddressSpacesResponse struct {
3939
Response
4040
LocalDefaultAddressSpace string
4141
GlobalDefaultAddressSpace string
4242
}
4343

44-
// RequestPoolRequest represents the expected data in a ``request address pool`` request message
44+
// RequestPoolRequest represents the expected data in a request address pool request message
4545
type RequestPoolRequest struct {
4646
AddressSpace string
4747
Pool string
@@ -50,45 +50,45 @@ type RequestPoolRequest struct {
5050
V6 bool
5151
}
5252

53-
// RequestPoolResponse represents the response message to a ``request address pool`` request
53+
// RequestPoolResponse represents the response message to a request address pool request
5454
type RequestPoolResponse struct {
5555
Response
5656
PoolID string
5757
Pool string // CIDR format
5858
Data map[string]string
5959
}
6060

61-
// ReleasePoolRequest represents the expected data in a ``release address pool`` request message
61+
// ReleasePoolRequest represents the expected data in a release address pool request message
6262
type ReleasePoolRequest struct {
6363
PoolID string
6464
}
6565

66-
// ReleasePoolResponse represents the response message to a ``release address pool`` request
66+
// ReleasePoolResponse represents the response message to a release address pool request
6767
type ReleasePoolResponse struct {
6868
Response
6969
}
7070

71-
// RequestAddressRequest represents the expected data in a ``request address`` request message
71+
// RequestAddressRequest represents the expected data in a request address request message
7272
type RequestAddressRequest struct {
7373
PoolID string
7474
Address string
7575
Options map[string]string
7676
}
7777

78-
// RequestAddressResponse represents the expected data in the response message to a ``request address`` request
78+
// RequestAddressResponse represents the expected data in the response message to a request address request
7979
type RequestAddressResponse struct {
8080
Response
8181
Address string // in CIDR format
8282
Data map[string]string
8383
}
8484

85-
// ReleaseAddressRequest represents the expected data in a ``release address`` request message
85+
// ReleaseAddressRequest represents the expected data in a release address request message
8686
type ReleaseAddressRequest struct {
8787
PoolID string
8888
Address string
8989
}
9090

91-
// ReleaseAddressResponse represents the response message to a ``release address`` request
91+
// ReleaseAddressResponse represents the response message to a release address request
9292
type ReleaseAddressResponse struct {
9393
Response
9494
}

netutils/utils_linux.go

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
//go:build linux
12
// +build linux
3+
24
// Network utility functions.
35

46
package netutils

0 commit comments

Comments
 (0)