Skip to content

Commit 004e8ee

Browse files
authored
refactor: switch to "github.com/cpuguy83/go-docker" (#48)
* doc: update README Signed-off-by: Jian Zeng <anonymousknight96@gmail.com> * doc: update badge Signed-off-by: Jian Zeng <anonymousknight96@gmail.com> * chore: update deps Signed-off-by: Jian Zeng <anonymousknight96@gmail.com> * refactor: switch to github.com/cpuguy83/go-docker Signed-off-by: Jian Zeng <anonymousknight96@gmail.com> * test: fix test Signed-off-by: Jian Zeng <anonymousknight96@gmail.com> * fix: check container creation error Signed-off-by: Jian Zeng <anonymousknight96@gmail.com> * test: switch to WAL journal mode in unit tests Signed-off-by: Jian Zeng <anonymousknight96@gmail.com> * style: deny github.com/docker/docker package Signed-off-by: Jian Zeng <anonymousknight96@gmail.com> * feat: use WAL journal mode by default Signed-off-by: Jian Zeng <anonymousknight96@gmail.com> * feat: validate repo image Signed-off-by: Jian Zeng <anonymousknight96@gmail.com> * style: make linter happy Signed-off-by: Jian Zeng <anonymousknight96@gmail.com> --------- Signed-off-by: Jian Zeng <anonymousknight96@gmail.com>
1 parent 73934f0 commit 004e8ee

11 files changed

Lines changed: 244 additions & 318 deletions

File tree

.golangci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ run:
3232
# https://golangci-lint.run/usage/linters/
3333
linters:
3434
enable:
35+
- depguard
3536
- exhaustive
3637
- exportloopref
3738
- gci
@@ -53,6 +54,12 @@ linters:
5354
- whitespace
5455

5556
linters-settings:
57+
depguard:
58+
rules:
59+
main:
60+
deny:
61+
- pkg: github.com/docker/docker
62+
msg: https://github.com/ustclug/Yuki/issues/44
5663
gci:
5764
sections:
5865
- standard # Standard section: captures all standard packages.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
README
22
=======
33

4-
[![Build Status](https://github.com/ustclug/Yuki/workflows/pr-presubmit-checks/badge.svg)](https://github.com/ustclug/Yuki/actions)
4+
[![Presubmit Checks](https://github.com/ustclug/Yuki/actions/workflows/pr-presubmit-checks.yml/badge.svg)](https://github.com/ustclug/Yuki/actions/workflows/pr-presubmit-checks.yml)
55
[![Go Report](https://goreportcard.com/badge/github.com/ustclug/Yuki)](https://goreportcard.com/report/github.com/ustclug/Yuki)
66

77
- [Requirements](#requirements)
@@ -54,7 +54,7 @@ Setup repository:
5454
# The repository directory must be created in advance
5555
mkdir /tmp/repos/docker-ce
5656

57-
# Sync docker-ce repository from mirrors.bfsu.edu.cn
57+
# Sync docker-ce repository from rsync.mirrors.ustc.edu.cn
5858
cat <<EOF > /tmp/repo-configs/docker-ce.yaml
5959
name: docker-ce
6060
# every 1 hour
@@ -63,7 +63,7 @@ storageDir: /tmp/repos/docker-ce
6363
image: ustcmirror/rsync:latest
6464
logRotCycle: 2
6565
envs:
66-
RSYNC_HOST: mirrors.bfsu.edu.cn
66+
RSYNC_HOST: rsync.mirrors.ustc.edu.cn
6767
RSYNC_PATH: docker-ce/
6868
RSYNC_EXCLUDE: --exclude=.~tmp~/
6969
RSYNC_EXTRA: --size-only

go.mod

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ module github.com/ustclug/Yuki
33
go 1.21
44

55
require (
6-
// https://github.com/moby/moby/issues/46621
7-
github.com/docker/docker v25.0.0-beta.3+incompatible
6+
github.com/cpuguy83/go-docker v0.3.0
87
github.com/docker/go-units v0.5.0
98
github.com/go-playground/validator/v10 v10.16.0
109
github.com/go-resty/resty/v2 v2.11.0
@@ -15,27 +14,21 @@ require (
1514
github.com/spf13/pflag v1.0.5
1615
github.com/spf13/viper v1.18.2
1716
github.com/stretchr/testify v1.8.4
18-
golang.org/x/sync v0.5.0
17+
golang.org/x/sync v0.6.0
1918
gorm.io/driver/sqlite v1.5.4
2019
gorm.io/gorm v1.25.5
2120
sigs.k8s.io/yaml v1.4.0
2221
)
2322

2423
require (
2524
github.com/Microsoft/go-winio v0.6.1 // indirect
26-
github.com/containerd/log v0.1.0 // indirect
2725
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
28-
github.com/distribution/reference v0.5.0 // indirect
29-
github.com/docker/go-connections v0.4.0 // indirect
30-
github.com/felixge/httpsnoop v1.0.4 // indirect
3126
github.com/fsnotify/fsnotify v1.7.0 // indirect
3227
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
33-
github.com/go-logr/logr v1.3.0 // indirect
34-
github.com/go-logr/stdr v1.2.2 // indirect
3528
github.com/go-playground/locales v0.14.1 // indirect
3629
github.com/go-playground/universal-translator v0.18.1 // indirect
37-
github.com/gogo/protobuf v1.3.2 // indirect
3830
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
31+
github.com/google/go-cmp v0.6.0 // indirect
3932
github.com/hashicorp/hcl v1.0.0 // indirect
4033
github.com/inconshreveable/mousetrap v1.1.0 // indirect
4134
github.com/jinzhu/inflection v1.0.0 // indirect
@@ -47,12 +40,7 @@ require (
4740
github.com/mattn/go-isatty v0.0.20 // indirect
4841
github.com/mattn/go-sqlite3 v1.14.19 // indirect
4942
github.com/mitchellh/mapstructure v1.5.0 // indirect
50-
github.com/moby/term v0.5.0 // indirect
51-
github.com/morikuni/aec v1.0.0 // indirect
52-
github.com/opencontainers/go-digest v1.0.0 // indirect
53-
github.com/opencontainers/image-spec v1.1.0-rc3 // indirect
5443
github.com/pelletier/go-toml/v2 v2.1.1 // indirect
55-
github.com/pkg/errors v0.9.1 // indirect
5644
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
5745
github.com/sagikazarmark/locafero v0.4.0 // indirect
5846
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
@@ -62,18 +50,12 @@ require (
6250
github.com/subosito/gotenv v1.6.0 // indirect
6351
github.com/valyala/bytebufferpool v1.0.0 // indirect
6452
github.com/valyala/fasttemplate v1.2.2 // indirect
65-
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect
66-
go.opentelemetry.io/otel v1.21.0 // indirect
67-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.21.0 // indirect
68-
go.opentelemetry.io/otel/metric v1.21.0 // indirect
69-
go.opentelemetry.io/otel/sdk v1.21.0 // indirect
70-
go.opentelemetry.io/otel/trace v1.21.0 // indirect
7153
go.uber.org/multierr v1.11.0 // indirect
7254
golang.org/x/crypto v0.17.0 // indirect
73-
golang.org/x/exp v0.0.0-20231226003508-02704c960a9b // indirect
55+
golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc // indirect
7456
golang.org/x/mod v0.14.0 // indirect
7557
golang.org/x/net v0.19.0 // indirect
76-
golang.org/x/sys v0.15.0 // indirect
58+
golang.org/x/sys v0.16.0 // indirect
7759
golang.org/x/text v0.14.0 // indirect
7860
golang.org/x/time v0.5.0 // indirect
7961
golang.org/x/tools v0.16.1 // indirect

0 commit comments

Comments
 (0)