Skip to content

Commit

Permalink
doc: note that go generate scripts are deprecated (sourcegraph#35270)
Browse files Browse the repository at this point in the history
  • Loading branch information
bobheadxi authored May 11, 2022
1 parent 5a43d3e commit 9f23d2f
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 7 deletions.
6 changes: 6 additions & 0 deletions dev/check/go-generate.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/usr/bin/env bash

echo "!!!!!!!!!!!!!!!!!!"
echo "!!! DEPRECATED !!!"
echo "!!!!!!!!!!!!!!!!!!"
echo "This script is deprecated!"
echo "Add your checks to 'dev/sg/internal/lint/linters' instead."

echo "--- go generate"

trap "echo ^^^ +++" ERR
Expand Down
16 changes: 11 additions & 5 deletions dev/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,29 @@
set -e
cd "$(dirname "${BASH_SOURCE[0]}")/.." # cd to repo root dir

echo "!!!!!!!!!!!!!!!!!!"
echo "!!! DEPRECATED !!!"
echo "!!!!!!!!!!!!!!!!!!"
echo "This script is deprecated!"
echo "Add your codegen tasks to 'sg generate' instead."

# We'll exclude generating the CLI reference documentation by default due to the
# relatively high cost of fetching and building src-cli.
go list ./... | grep -v 'doc/cli/references' | xargs go generate -x

FIND="find"
if [ "$(uname)" = "Darwin" ]; then
FIND="gfind"
FIND="gfind"
fi
# Ignore the submodules in docker-images syntax-highlighter.
#
# Disable shellcheck for this line because we actually want them to be space separated
# (goimports doesn't accept passing args by stdin)
#
# shellcheck disable=SC2046
GOBIN="$PWD/.bin" go install golang.org/x/tools/cmd/goimports && \
./.bin/goimports -w $(
comm -12 <(git ls-files | sort) <("$FIND" . -type f -name '*.go' -printf "%P\n" | sort)
)
GOBIN="$PWD/.bin" go install golang.org/x/tools/cmd/goimports &&
./.bin/goimports -w $(
comm -12 <(git ls-files | sort) <("$FIND" . -type f -name '*.go' -printf "%P\n" | sort)
)

go mod tidy
2 changes: 1 addition & 1 deletion doc/dev/background-information/dependencies_and_codegen.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The Sourcegraph repository relies on code generation triggered by `go generate`.
To generate everything, just run:

```bash
./dev/generate.sh
sg generate
```

Note: Sometimes, there are erroneous diffs. This occurs for a few
Expand Down
6 changes: 6 additions & 0 deletions enterprise/dev/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
set -e
cd "$(dirname "${BASH_SOURCE[0]}")/.." # cd to enterprise/

echo "!!!!!!!!!!!!!!!!!!"
echo "!!! DEPRECATED !!!"
echo "!!!!!!!!!!!!!!!!!!"
echo "This script is deprecated!"
echo "Add your codegen tasks to 'sg generate' instead."

../dev/generate.sh

go list ./... | xargs go generate -x
2 changes: 1 addition & 1 deletion migrations/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Migration files created
Metadata file: ~/migrations/codeintel/1644260831/metadata.yaml
```

This will create an _up_ and _down_ pair of migration files (whose path is printed by the following command). Add SQL statements to these files that will perform the desired migration. After adding SQL statements to those files, update the schema doc via `go generate ./internal/database/` (or regenerate everything via `./dev/generate.sh`).
This will create an _up_ and _down_ pair of migration files (whose path is printed by the following command). Add SQL statements to these files that will perform the desired migration. After adding SQL statements to those files, update the schema doc via `go generate ./internal/database/` (or regenerate everything via `sg generate`).

To pass CI, you'll additionally need to:

Expand Down

0 comments on commit 9f23d2f

Please sign in to comment.