blob: 5ea15c957c264d2f416490b6f8cf90ccce905caf [file] [log] [blame]
Russ Coxbccf9cd2024-08-12 10:46:38 -04001#!/bin/bash
2# Copyright 2024 The Go Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style
4# license that can be found in the LICENSE file.
5
6# Run worksync.sh to sync the various go.work, go.work.sum, go.mod, and go.sum files
7# after changing dependencies.
8
9set -e
10
11syncmod() {
12 dir=$1
13 oscars=$(GOWORK=off go -C $dir list -m ... | awk 'NR>1 && /^golang.org\/x\/oscar/ { print $1 "@master" }')
14 if [ "$oscars" != "" ]; then
15 go -C $dir get $oscars
16 fi
17}
18
19tidymod() {
20 dir=$1
21 go -C $dir mod tidy
22}
23
24moddirs="$(find . -name go.mod | sed 's;/go.mod;;')"
25
26for dir in $moddirs
27do
28 syncmod $dir
29done
30
31go work sync
32
33for dir in $moddirs
34do
35 tidymod $dir
36done