Skip to content

Commit

Permalink
Merge pull request #457 from evanlinjin/feature/go-mod-comment-uncomm…
Browse files Browse the repository at this point in the history
…ent-make-targets

Add go.mod comment/uncomment make targets.
  • Loading branch information
志宇 authored Jul 2, 2019
2 parents 9b8d26b + 03acef5 commit 7f3b6cf
Show file tree
Hide file tree
Showing 7 changed files with 274 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,7 @@ pkg/node/foo/
/*-server
/*.json
/*.sh
/*.log
/*.log

# Ignore backup go.mod after running '/ci_scripts/go_mod_replace.sh'.
go.mod-e
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 7f3b6cf

Please sign in to comment.