Skip to content

Commit

Permalink
*: enable a go workspace
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Valdes <[email protected]>
  • Loading branch information
ivanvc committed Jul 19, 2024
1 parent e7f5729 commit 2fa0fbf
Show file tree
Hide file tree
Showing 12 changed files with 437 additions and 68 deletions.
10 changes: 0 additions & 10 deletions api/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,3 @@ require (
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

// Bad imports are sometimes causing attempts to pull that code.
// This makes the error more explicit.
replace (
go.etcd.io/etcd => ./FORBIDDEN_DEPENDENCY
go.etcd.io/etcd/api/v3 => ./FORBIDDEN_DEPENDENCY
go.etcd.io/etcd/pkg/v3 => ./FORBIDDEN_DEPENDENCY
go.etcd.io/etcd/tests/v3 => ./FORBIDDEN_DEPENDENCY
go.etcd.io/etcd/v3 => ./FORBIDDEN_DEPENDENCY
)
9 changes: 0 additions & 9 deletions client/internal/v2/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,3 @@ replace (
go.etcd.io/etcd/api/v3 => ./../../../api
go.etcd.io/etcd/client/pkg/v3 => ./../../pkg
)

// Bad imports are sometimes causing attempts to pull that code.
// This makes the error more explicit.
replace (
go.etcd.io/etcd => ./FORBIDDEN_DEPENDENCY
go.etcd.io/etcd/pkg/v3 => ./FORBIDDED_DEPENDENCY
go.etcd.io/etcd/tests/v3 => ./FORBIDDEN_DEPENDENCY
go.etcd.io/etcd/v3 => ./FORBIDDEN_DEPENDENCY
)
9 changes: 0 additions & 9 deletions client/v3/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,3 @@ replace (
go.etcd.io/etcd/api/v3 => ../../api
go.etcd.io/etcd/client/pkg/v3 => ../pkg
)

// Bad imports are sometimes causing attempts to pull that code.
// This makes the error more explicit.
replace (
go.etcd.io/etcd => ./FORBIDDEN_DEPENDENCY
go.etcd.io/etcd/pkg/v3 => ./FORBIDDEN_DEPENDENCY
go.etcd.io/etcd/v3 => ./FORBIDDEN_DEPENDENCY
go.etcd.io/tests/v3 => ./FORBIDDEN_DEPENDENCY
)
8 changes: 0 additions & 8 deletions etcdctl/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,3 @@ replace (
go.etcd.io/etcd/client/v3 => ../client/v3
go.etcd.io/etcd/pkg/v3 => ../pkg
)

// Bad imports are sometimes causing attempts to pull that code.
// This makes the error more explicit.
replace (
go.etcd.io/etcd => ./FORBIDDEN_DEPENDENCY
go.etcd.io/etcd/v3 => ./FORBIDDEN_DEPENDENCY
go.etcd.io/tests/v3 => ./FORBIDDEN_DEPENDENCY
)
8 changes: 0 additions & 8 deletions etcdutl/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@ replace (
go.etcd.io/etcd/server/v3 => ../server
)

// Bad imports are sometimes causing attempts to pull that code.
// This makes the error more explicit.
replace (
go.etcd.io/etcd => ./FORBIDDEN_DEPENDENCY
go.etcd.io/etcd/v3 => ./FORBIDDEN_DEPENDENCY
go.etcd.io/tests/v3 => ./FORBIDDEN_DEPENDENCY
)

require (
github.com/coreos/go-semver v0.3.1
github.com/dustin/go-humanize v1.0.1
Expand Down
17 changes: 17 additions & 0 deletions go.work
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
go 1.22.5

use (
.
./api
./client/internal/v2
./client/pkg
./client/v3
./etcdctl
./etcdutl
./pkg
./server
./tests
./tools/mod
./tools/rw-heatmaps
./tools/testgrid-analysis
)
415 changes: 415 additions & 0 deletions go.work.sum

Large diffs are not rendered by default.

11 changes: 0 additions & 11 deletions pkg/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,3 @@ require (
)

replace go.etcd.io/etcd/client/pkg/v3 => ../client/pkg

// Bad imports are sometimes causing attempts to pull that code.
// This makes the error more explicit.
// Etcd contains lots of packages and dependency relationship.
// Shouldn't import unnecessary dependencies
replace (
go.etcd.io/etcd => ./FORBIDDEN_DEPENDENCY
go.etcd.io/etcd/api/v3 => ./FORBIDDEN_DEPENDENCY
go.etcd.io/etcd/tests/v3 => ./FORBIDDEN_DEPENDENCY
go.etcd.io/etcd/v3 => ./FORBIDDEN_DEPENDENCY
)
6 changes: 2 additions & 4 deletions scripts/release_mod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ function push_mod_tags_cmd {
log_info "REMOTE_REPO: ${REMOTE_REPO}"

# Any module ccan be used for this
local main_version
main_version=$(go list -f '{{.Version}}' -m "${ROOT_MODULE}/api/v3")
local tags=()

keyid=$(get_gpg_key) || return 2
Expand All @@ -110,8 +108,8 @@ function push_mod_tags_cmd {
local subdir="${path//${ROOT_MODULE}\//}"
local tag
if [ -z "${version}" ]; then
tag="${main_version}"
version="${main_version}"
tag="${TARGET_VERSION}"
version="${TARGET_VERSION}"
else
tag="${subdir///v[23]/}/${version}"
fi
Expand Down
4 changes: 2 additions & 2 deletions scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ function bom_pass {
run cp go.sum go.sum.tmp || return 2
run cp go.mod go.mod.tmp || return 2

output=$(GOFLAGS=-mod=mod run_go_tool github.com/appscodelabs/license-bill-of-materials \
output=$(run_go_tool github.com/appscodelabs/license-bill-of-materials \
--override-file ./bill-of-materials.override.json \
"${modules[@]}")
code="$?"
Expand All @@ -540,7 +540,7 @@ function bom_pass {

function dump_deps_of_module() {
local module
if ! module=$(run go list -m); then
if ! module=$(go mod edit -json | jq -r '.Module.Path'); then
return 255
fi
run go mod edit -json | jq -r '.Require[] | .Path+","+.Version+","+if .Indirect then " (indirect)" else "" end+",'"${module}"'"'
Expand Down
2 changes: 1 addition & 1 deletion scripts/updatebom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function bom_fixlet {
# shellcheck disable=SC2207
modules=($(modules_exp))

if GOFLAGS=-mod=mod run_go_tool "github.com/appscodelabs/license-bill-of-materials" \
if run_go_tool "github.com/appscodelabs/license-bill-of-materials" \
--override-file ./bill-of-materials.override.json \
"${modules[@]}" > ./bill-of-materials.json.tmp; then
cp ./bill-of-materials.json.tmp ./bill-of-materials.json
Expand Down
6 changes: 0 additions & 6 deletions server/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,3 @@ replace (
go.etcd.io/etcd/client/v3 => ../client/v3
go.etcd.io/etcd/pkg/v3 => ../pkg
)

// Bad imports are sometimes causing attempts to pull that code.
// This makes the error more explicit.
replace go.etcd.io/etcd => ./FORBIDDEN_DEPENDENCY

replace go.etcd.io/tests/v3 => ./FORBIDDEN_DEPENDENCY

0 comments on commit 2fa0fbf

Please sign in to comment.