aboutsummaryrefslogtreecommitdiff
path: root/examples/counter/main.go
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2019-08-15 18:57:20 -0400
committerDeterminant <[email protected]>2019-08-15 18:57:20 -0400
commit1c1fa76addab68e04e051df3f38cce9f3bb32d98 (patch)
tree4fd8ae6f9973642f0ac58ee5b9af81669ac4cddb /examples/counter/main.go
parentff58d84f81d584646ca3f8fe00493cdcec8239ed (diff)
auto detect gopath
Diffstat (limited to 'examples/counter/main.go')
-rw-r--r--examples/counter/main.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/examples/counter/main.go b/examples/counter/main.go
index 662fea1..e7961e5 100644
--- a/examples/counter/main.go
+++ b/examples/counter/main.go
@@ -13,6 +13,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
+ "go/build"
"math/big"
"os"
"os/signal"
@@ -65,7 +66,11 @@ func main() {
config.Miner.ManualUncle = true
// compile the smart contract
- counterSrc, err := filepath.Abs("./counter.sol")
+ gopath := os.Getenv("GOPATH")
+ if gopath == "" {
+ gopath = build.Default.GOPATH
+ }
+ counterSrc, err := filepath.Abs(gopath + "/src/github.com/ava-labs/coreth/examples/counter/counter.sol")
checkError(err)
contracts, err := compiler.CompileSolidity("", counterSrc)
checkError(err)