This repository was archived by the owner on Nov 27, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 10 files changed +84
-55
lines changed Expand file tree Collapse file tree 10 files changed +84
-55
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ RUN --mount=target=. \
108108 make -f builder.Makefile test
109109
110110FROM base AS check-license-headers
111- RUN go get -u github.com/kunalkushwaha/ltag
111+ RUN go install github.com/google/addlicense@latest
112112RUN --mount=target=. \
113113 make -f builder.Makefile check-license-headers
114114
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
12// +build e2e
23
34/*
4- Copyright 2020 Docker Compose CLI authors
5+ Copyright 2020, 2022 Docker Compose CLI authors
56
67 Licensed under the Apache License, Version 2.0 (the "License");
78 you may not use this file except in compliance with the License.
@@ -22,7 +23,7 @@ import (
2223 "os"
2324)
2425
25- func init () {
26+ func overrideSocket () {
2627 testSocket , defined := os .LookupEnv ("TEST_METRICS_SOCKET" )
2728 if defined {
2829 socket = testSocket
Original file line number Diff line number Diff line change 1+ //go:build !e2e
2+ // +build !e2e
3+
14/*
2- Copyright 2020 Docker Compose CLI authors
5+ Copyright 2022 Docker Compose CLI authors
36
47 Licensed under the Apache License, Version 2.0 (the "License");
58 you may not use this file except in compliance with the License.
1417 limitations under the License.
1518*/
1619
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
23
34/*
4- Copyright 2020 Docker Compose CLI authors
5+ Copyright 2020, 2022 Docker Compose CLI authors
56
67 Licensed under the Apache License, Version 2.0 (the "License");
78 you may not use this file except in compliance with the License.
1819
1920package metrics
2021
21- import "net"
22+ import (
23+ "net"
24+ "path/filepath"
25+
26+ "github.com/docker/docker/pkg/homedir"
27+ )
2228
2329var (
24- socket = "/var/run/docker-cli.sock "
30+ socket = ""
2531)
2632
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+
2741func conn () (net.Conn , error ) {
2842 return net .Dial ("unix" , socket )
2943}
Original file line number Diff line number Diff line change 1+ //go:build windows
12// +build windows
23
34/*
4- Copyright 2020 Docker Compose CLI authors
5+ Copyright 2020, 2022 Docker Compose CLI authors
56
67 Licensed under the Apache License, Version 2.0 (the "License");
78 you may not use this file except in compliance with the License.
3031 socket = `\\.\pipe\docker_cli`
3132)
3233
34+ func init () {
35+ overrideSocket () // no-op, unless built for e2e testing
36+ }
37+
3338func conn () (net.Conn , error ) {
3439 if strings .HasPrefix (socket , `\\.\pipe\` ) {
3540 timeout := 200 * time .Millisecond
Original file line number Diff line number Diff line change 11#! /usr/bin/env sh
22
3- # Copyright Docker Compose CLI authors
3+ # Copyright 2020, 2022 Docker Compose CLI authors
44
55# Licensed under the Apache License, Version 2.0 (the "License");
66# you may not use this file except in compliance with the License.
1616
1717set -eu -o pipefail
1818
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 "
2222 exit 1
2323fi
2424
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