You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: build/update-deps.ps1
+7-4Lines changed: 7 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -3,21 +3,24 @@ $workingDir = $(pwd).Path
3
3
# We don't want to update transitive dependencies, so instead of using `go get -u` we use
4
4
# `go get $(go list -f '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}' -m all)`
5
5
# as suggested in https://github.com/golang/go/issues/28424#issuecomment-1101896499.
6
+
functionGet-DirectDependencies {
7
+
go list -f'{{if not (or .Main .Indirect)}}{{.Path}}{{end}}'-m all
8
+
}
6
9
7
10
# Helper packages
8
11
$array=@("encoding","sql","test","util")
9
12
foreach ($moduleNamein$array){
10
13
echo "updating $moduleName"
11
-
cd "$PSScriptRoot/../$moduleName"; go get $(go list -f'{{if not (or .Main .Indirect)}}{{.Path}}{{end}}'-m all); go mod tidy; cd $workingDir
14
+
cd "$PSScriptRoot/../$moduleName"; go get $(Get-DirectDependencies); go mod tidy; cd $workingDir
12
15
}
13
16
14
17
# Implementations
15
18
cat "$PSScriptRoot/implementations"|foreach {
16
19
echo "updating $_"
17
-
cd "$PSScriptRoot/../$_"; go get $(go list -f'{{if not (or .Main .Indirect)}}{{.Path}}{{end}}'-m all); go mod tidy; cd $workingDir
20
+
cd "$PSScriptRoot/../$_"; go get $(Get-DirectDependencies); go mod tidy; cd $workingDir
18
21
}
19
22
20
23
# Examples
21
24
echo "updating examples"
22
-
cd "$PSScriptRoot/../examples/redis"; go get $(go list -f'{{if not (or .Main .Indirect)}}{{.Path}}{{end}}'-m all); go mod tidy; cd $workingDir
23
-
cd "$PSScriptRoot/../examples/proto_encoding"; go get $(go list -f'{{if not (or .Main .Indirect)}}{{.Path}}{{end}}'-m all); go mod tidy; cd $workingDir
25
+
cd "$PSScriptRoot/../examples/redis"; go get $(Get-DirectDependencies); go mod tidy; cd $workingDir
26
+
cd "$PSScriptRoot/../examples/proto_encoding"; go get $(Get-DirectDependencies); go mod tidy; cd $workingDir
go list -f '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}' -m all
19
+
}
20
+
17
21
# Helper packages
18
22
array=( encoding sql test util )
19
23
forMODULE_NAMEin"${array[@]}";do
20
24
echo"updating $MODULE_NAME"
21
-
(cd "$SCRIPT_DIR"/../"$MODULE_NAME"&& go get $(go list -f '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}' -m all)&& go mod tidy) || (cd "$WORKING_DIR"&&echo" failed"&&exit 1)
25
+
(cd "$SCRIPT_DIR"/../"$MODULE_NAME"&& go get $(get_direct_dependencies)&& go mod tidy) || (cd "$WORKING_DIR"&&echo" failed"&&exit 1)
(cd "$SCRIPT_DIR"/../"$MODULE_NAME"&& go get $(go list -f '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}' -m all)&& go mod tidy) || (cd "$WORKING_DIR"&&echo" failed"&&exit 1)
31
+
(cd "$SCRIPT_DIR"/../"$MODULE_NAME"&& go get $(get_direct_dependencies)&& go mod tidy) || (cd "$WORKING_DIR"&&echo" failed"&&exit 1)
28
32
done
29
33
30
34
# Examples
31
-
(cd "$SCRIPT_DIR"/../examples/redis && go get $(go list -f '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}' -m all)&& go mod tidy) || (cd "$WORKING_DIR"&&echo"update failed"&&exit 1)
32
-
(cd "$SCRIPT_DIR"/../examples/protobuf_encoding && go get $(go list -f '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}' -m all)&& go mod tidy) || (cd "$WORKING_DIR"&&echo"update failed"&&exit 1)
35
+
(cd "$SCRIPT_DIR"/../examples/redis && go get $(get_direct_dependencies)&& go mod tidy) || (cd "$WORKING_DIR"&&echo"update failed"&&exit 1)
36
+
(cd "$SCRIPT_DIR"/../examples/protobuf_encoding && go get $(get_direct_dependencies)&& go mod tidy) || (cd "$WORKING_DIR"&&echo"update failed"&&exit 1)
0 commit comments