mirror of
https://github.com/golang/go.git
synced 2025-10-19 19:13:18 +00:00
cmd/go: create temporary cleanup script
This is a large series of sed commands to cleanup after successful use of the `rf inject` command. This script will be used to refactor the codebase to eliminate global state within the module loader. Once that effort is complete, this script will be removed. This commit is part of the overall effort to eliminate global modloader state. Change-Id: If04926b5ca5b7230f91ac98fe4a82c20ef5f73ee Reviewed-on: https://go-review.googlesource.com/c/go/+/709978 Reviewed-by: Michael Matloob <matloob@golang.org> TryBot-Bypass: Ian Alexander <jitsu@google.com> Commit-Queue: Ian Alexander <jitsu@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
This commit is contained in:
parent
7056c71d32
commit
36086e85f8
1 changed files with 43 additions and 0 deletions
43
src/cmd/go/internal/rf-cleanup.zsh
Executable file
43
src/cmd/go/internal/rf-cleanup.zsh
Executable file
|
@ -0,0 +1,43 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
set -eu -o pipefail
|
||||||
|
|
||||||
|
# This is a large series of sed commands to cleanup after successful use of the
|
||||||
|
# `rf inject` command. This script will be used to refactor the codebase to
|
||||||
|
# eliminate global state within the module loader. Once that effort is
|
||||||
|
# complete, this script will be removed.
|
||||||
|
|
||||||
|
find . -name '*.go' -exec \
|
||||||
|
sed -i '
|
||||||
|
#
|
||||||
|
# CompileAction does not use loaderstate.
|
||||||
|
#
|
||||||
|
s/CompileAction(loaderstate[^ ]* \*modload.State, /CompileAction(/g
|
||||||
|
s/CompileAction(modload.LoaderState[^,]*, /CompileAction(/g
|
||||||
|
s/CompileAction(loaderstate[^,]*, /CompileAction(/g
|
||||||
|
#
|
||||||
|
# cgoAction does not use loaderstate.
|
||||||
|
#
|
||||||
|
s/cgoAction(loaderstate \*modload\.State, /cgoAction(/g
|
||||||
|
s/cgoAction(loaderstate, /cgoAction(/g
|
||||||
|
s/cgoAction(loaderstate_, /cgoAction(/g
|
||||||
|
#
|
||||||
|
# Remove redundant mentions of LoaderState from function call sites.
|
||||||
|
#
|
||||||
|
s/(modload\.LoaderState_*, loaderstate,/(loaderstate,/g
|
||||||
|
s/(modload\.LoaderState_*, moduleLoaderState,/(moduleLoaderState,/g
|
||||||
|
s/(modload\.LoaderState_*, modload\.LoaderState/(modload.LoaderState/g
|
||||||
|
s/(modload\.LoaderState_*, loaderstate,/(loaderstate,/g
|
||||||
|
s/(modload\.LoaderState_*, moduleLoaderState,/(moduleLoaderState,/g
|
||||||
|
s/(modload\.LoaderState_*, modload\.LoaderState,/(modload.LoaderState,/g
|
||||||
|
s/(loaderstate_* \*modload.State, loaderstate \*modload.State/(loaderstate *modload.State/g
|
||||||
|
s/(loaderstate_* \*State, loaderstate \*State/(loaderstate *State/g
|
||||||
|
s/(loaderstate_*, loaderstate,/(loaderstate,/g
|
||||||
|
s/(LoaderState_*, loaderstate,/(loaderstate,/g
|
||||||
|
s/(LoaderState_*, loaderState,/(loaderState,/g
|
||||||
|
s/(LoaderState_*, LoaderState,/(LoaderState,/g
|
||||||
|
s/(LoaderState_*, LoaderState,/(LoaderState,/g
|
||||||
|
s/(moduleLoaderState_*, loaderstate,/(loaderstate,/g
|
||||||
|
s/(moduleLoaderState_*, moduleLoaderState,/(moduleLoaderState,/g
|
||||||
|
' {} \;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue