Skip to content

Commit

Permalink
added make targets for commenting line in go.mod
Browse files Browse the repository at this point in the history
  • Loading branch information
林志宇 committed Jul 1, 2019
1 parent 9b8d26b commit 6ed2583
Show file tree
Hide file tree
Showing 6 changed files with 270 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ integration-run-proxy: ## Runs the proxy interactive testing environment
integration-run-ssh: ## Runs the ssh interactive testing environment
./integration/run-ssh-env.sh

mod-comm: ## Comments the 'replace' rule in go.mod
./ci_scripts/go_mod_replace.sh comment go.mod

mod-uncomm: ## Uncomments the 'replace' rule in go.mod
./ci_scripts/go_mod_replace.sh uncomment go.mod

help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

34 changes: 34 additions & 0 deletions ci_scripts/go_mod_replace.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash

if [[ $# -ne 2 ]]; then
exit 0
fi

# Inputs.
action=$1
filename=$2

# Line to comment/uncomment in go.mod
line="replace github.com\/skycoin\/dmsg => ..\/dmsg"

function print_usage() {
echo $"Usage: $0 (comment|uncomment) <filename>"
}

case "$action" in
comment)
echo "commenting ${filename}..."
sed -i -e "/$line/s/^\/*/\/\//" ${filename}
;;
uncomment)
echo "uncommenting ${filename}..."
sed -i -e "/$line/s/^\/\/*//" ${filename}
;;
help)
print_usage
;;
*)
print_usage
exit 1
;;
esac
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ require (
golang.org/x/text v0.3.2 // indirect
golang.org/x/tools v0.0.0-20190627033414-4874f863e654 // indirect
)

// Uncomment for tests with alternate branches of 'dmsg'
//replace github.com/skycoin/dmsg => ../dmsg
11 changes: 11 additions & 0 deletions vendor/github.com/skycoin/dmsg/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

195 changes: 195 additions & 0 deletions vendor/github.com/skycoin/dmsg/.golangci.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions vendor/github.com/skycoin/dmsg/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6ed2583

Please sign in to comment.