This repository was archived by the owner on Nov 27, 2023. It is now read-only.
File tree 10 files changed +84
-55
lines changed
10 files changed +84
-55
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ RUN --mount=target=. \
108
108
make -f builder.Makefile test
109
109
110
110
FROM base AS check-license-headers
111
- RUN go get -u github.com/kunalkushwaha/ltag
111
+ RUN go install github.com/google/addlicense@latest
112
112
RUN --mount=target=. \
113
113
make -f builder.Makefile check-license-headers
114
114
Original file line number Diff line number Diff line change
1
+ //go:build darwin
2
+ // +build darwin
3
+
4
+ /*
5
+ Copyright 2022 Docker Compose CLI authors
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+ */
19
+
20
+ package metrics
21
+
22
+ import (
23
+ "net"
24
+ "path/filepath"
25
+
26
+ "github.com/docker/docker/pkg/homedir"
27
+ )
28
+
29
+ var (
30
+ socket = "/var/run/docker-cli.sock"
31
+ )
32
+
33
+ func init () {
34
+ // Attempt to retrieve the Docker CLI socket for the current user.
35
+ if home := homedir .Get (); home != "" {
36
+ socket = filepath .Join (home , "/Library/Containers/com.docker.docker/Data/docker-cli.sock" )
37
+ } // else: On macOS Docker Desktop creates symlinks in /var/run, so fall back to the old default.
38
+ overrideSocket () // nop, unless built for e2e testing
39
+ }
40
+
41
+ func conn () (net.Conn , error ) {
42
+ return net .Dial ("unix" , socket )
43
+ }
Original file line number Diff line number Diff line change
1
+ //go:build e2e
1
2
// +build e2e
2
3
3
4
/*
4
- Copyright 2020 Docker Compose CLI authors
5
+ Copyright 2020, 2022 Docker Compose CLI authors
5
6
6
7
Licensed under the Apache License, Version 2.0 (the "License");
7
8
you may not use this file except in compliance with the License.
@@ -22,7 +23,7 @@ import (
22
23
"os"
23
24
)
24
25
25
- func init () {
26
+ func overrideSocket () {
26
27
testSocket , defined := os .LookupEnv ("TEST_METRICS_SOCKET" )
27
28
if defined {
28
29
socket = testSocket
Original file line number Diff line number Diff line change
1
+ //go:build !e2e
2
+ // +build !e2e
3
+
1
4
/*
2
- Copyright 2020 Docker Compose CLI authors
5
+ Copyright 2022 Docker Compose CLI authors
3
6
4
7
Licensed under the Apache License, Version 2.0 (the "License");
5
8
you may not use this file except in compliance with the License.
14
17
limitations under the License.
15
18
*/
16
19
20
+ package metrics
21
+
22
+ func overrideSocket () {
23
+ }
Original file line number Diff line number Diff line change 1
- // +build !windows
1
+ //go:build !windows,!darwin
2
+ // +build !windows,!darwin
2
3
3
4
/*
4
- Copyright 2020 Docker Compose CLI authors
5
+ Copyright 2020, 2022 Docker Compose CLI authors
5
6
6
7
Licensed under the Apache License, Version 2.0 (the "License");
7
8
you may not use this file except in compliance with the License.
18
19
19
20
package metrics
20
21
21
- import "net"
22
+ import (
23
+ "net"
24
+ "path/filepath"
25
+
26
+ "github.com/docker/docker/pkg/homedir"
27
+ )
22
28
23
29
var (
24
- socket = "/var/run/docker-cli.sock "
30
+ socket = ""
25
31
)
26
32
33
+ func init () {
34
+ // Attempt to retrieve the Docker CLI socket for the current user.
35
+ if home := homedir .Get (); home != "" {
36
+ socket = filepath .Join (home , ".docker/desktop/docker-cli.sock" )
37
+ } // else: On Linux we don't expect to have a global CLI socket, so leave it empty and let connections fail.
38
+ overrideSocket () // nop, unless built for e2e testing
39
+ }
40
+
27
41
func conn () (net.Conn , error ) {
28
42
return net .Dial ("unix" , socket )
29
43
}
Original file line number Diff line number Diff line change
1
+ //go:build windows
1
2
// +build windows
2
3
3
4
/*
4
- Copyright 2020 Docker Compose CLI authors
5
+ Copyright 2020, 2022 Docker Compose CLI authors
5
6
6
7
Licensed under the Apache License, Version 2.0 (the "License");
7
8
you may not use this file except in compliance with the License.
30
31
socket = `\\.\pipe\docker_cli`
31
32
)
32
33
34
+ func init () {
35
+ overrideSocket () // no-op, unless built for e2e testing
36
+ }
37
+
33
38
func conn () (net.Conn , error ) {
34
39
if strings .HasPrefix (socket , `\\.\pipe\` ) {
35
40
timeout := 200 * time .Millisecond
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env sh
2
2
3
- # Copyright Docker Compose CLI authors
3
+ # Copyright 2020, 2022 Docker Compose CLI authors
4
4
5
5
# Licensed under the Apache License, Version 2.0 (the "License");
6
6
# you may not use this file except in compliance with the License.
16
16
17
17
set -eu -o pipefail
18
18
19
- if ! command -v ltag ; then
20
- >&2 echo " ERROR: ltag not found. Install with:"
21
- >&2 echo " go get -u github.com/kunalkushwaha/ltag "
19
+ if ! command -v addlicense ; then
20
+ >&2 echo " ERROR: addlicense not found. Install with:"
21
+ >&2 echo " go install github.com/google/addlicense@latest "
22
22
exit 1
23
23
fi
24
24
25
- BASEPATH=" ${1-} "
26
-
27
- ltag -t " ${BASEPATH} scripts/validate/template" -excludes " validate testdata resolvepath" --check -v
25
+ find . -regex ' .*\.sh' -o -regex ' .*\.go' -o -regex ' .*Makefile' -o -regex ' .*Dockerfile' | xargs addlicense -check -l apache -c ' Docker Compose CLI authors' -ignore validate -ignore testdata -ignore resolvepath -v 1>&2
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments