From 26a953553320467fbfe78ed8012b392d70801bfa Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Mon, 30 Sep 2024 06:25:50 +0000 Subject: [PATCH] build: move go.mod to sub directories To separate spec requirements from tool requirements. Signed-off-by: Peng Tao --- .github/workflows/lint.yml | 10 ++++++++-- go.mod | 16 ---------------- specs-go/go.mod | 7 +++++++ specs-go/go.sum | 4 ++++ tools/mdctl/go.mod | 22 ++++++++++++++++++++++ go.sum => tools/mdctl/go.sum | 0 6 files changed, 41 insertions(+), 18 deletions(-) delete mode 100644 go.mod create mode 100644 specs-go/go.mod create mode 100644 specs-go/go.sum create mode 100644 tools/mdctl/go.mod rename go.sum => tools/mdctl/go.sum (100%) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b923f1b..2d57b11 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -14,20 +14,26 @@ jobs: name: Lint runs-on: ubuntu-latest timeout-minutes: 30 + strategy: + matrix: + include: + - go-path: tools/mdctl + - go-path: specs-go steps: - name: Checkout code uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 with: - go-version-file: go.mod + go-version-file: specs-go/go.mod cache: false - name: Golangci lint uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 with: version: v1.54 - args: --verbose + working-directory: ${{ matrix.go-path }} + args: --config $GITHUB_WORKSPACE/.golangci.yml --verbose - name: Markdown lint uses: docker://avtodev/markdown-lint:v1@sha256:6aeedc2f49138ce7a1cd0adffc1b1c0321b841dc2102408967d9301c031949ee diff --git a/go.mod b/go.mod deleted file mode 100644 index 9bd5e0e..0000000 --- a/go.mod +++ /dev/null @@ -1,16 +0,0 @@ -module github.com/CloudNativeAI/model-spec - -go 1.22.4 - -require ( - github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/klauspost/compress v1.17.10 // indirect - github.com/opencontainers/go-digest v1.0.0 // indirect - github.com/opencontainers/image-spec v1.1.0 // indirect - github.com/spf13/cobra v1.8.1 // indirect - github.com/spf13/pflag v1.0.5 // indirect - golang.org/x/sync v0.6.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/term v0.24.0 // indirect - oras.land/oras-go/v2 v2.5.0 // indirect -) diff --git a/specs-go/go.mod b/specs-go/go.mod new file mode 100644 index 0000000..d7c15cf --- /dev/null +++ b/specs-go/go.mod @@ -0,0 +1,7 @@ +module github.com/CloudNativeAI/model-spec/specs-go + +go 1.23.1 + +require github.com/opencontainers/image-spec v1.1.0 + +require github.com/opencontainers/go-digest v1.0.0 // indirect diff --git a/specs-go/go.sum b/specs-go/go.sum new file mode 100644 index 0000000..5b6c8bf --- /dev/null +++ b/specs-go/go.sum @@ -0,0 +1,4 @@ +github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= +github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug= +github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM= diff --git a/tools/mdctl/go.mod b/tools/mdctl/go.mod new file mode 100644 index 0000000..ee2afb1 --- /dev/null +++ b/tools/mdctl/go.mod @@ -0,0 +1,22 @@ +module github.com/CloudNativeAI/model-spec/tools/mdctl + +go 1.23.1 + +replace github.com/CloudNativeAI/model-spec/specs-go => ../../specs-go/ + +require ( + github.com/CloudNativeAI/model-spec/specs-go v0.0.0-00010101000000-000000000000 + github.com/klauspost/compress v1.17.10 + github.com/opencontainers/go-digest v1.0.0 + github.com/opencontainers/image-spec v1.1.0 + github.com/spf13/cobra v1.8.1 + golang.org/x/term v0.24.0 + oras.land/oras-go/v2 v2.5.0 +) + +require ( + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + golang.org/x/sync v0.6.0 // indirect + golang.org/x/sys v0.25.0 // indirect +) diff --git a/go.sum b/tools/mdctl/go.sum similarity index 100% rename from go.sum rename to tools/mdctl/go.sum