Skip to content

Commit

Permalink
add script to tidy all modules
Browse files Browse the repository at this point in the history
Signed-off-by: Jin Dong <[email protected]>
  • Loading branch information
djdongjin committed Dec 30, 2024
1 parent 7fc4260 commit e87d432
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ build-plugins: $(PLUGINS)
build-check:
$(Q)$(GO_BUILD) -v $(GO_MODULES)

mod-tidy:
$(Q)$(GO_CMD) mod tidy
$(Q)./scripts/go-mod-tidy

#
# clean targets
#
Expand Down
28 changes: 28 additions & 0 deletions scripts/go-mod-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

# Copyright The containerd Authors.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#
# Run go mod tidy in all go modules
#
set -eu -o pipefail

find . -name go.mod | while read -r gomod; do
dir=$(dirname "$gomod")

pushd "$dir"
go mod tidy
popd
done

0 comments on commit e87d432

Please sign in to comment.