nicolopignatelli / wc2018-slack-bot

World Cup 2018 Slack Bot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enviroment error

victornjg opened this issue · comments

Hello,

I'm trying to install the bot on my machine and I'm getting this error:

docker-compose run --rm app sh -c 'go build -o bin/wc2018-slack-bot src/main/main.go'
src/main/main.go:8:2: cannot find package "github.com/caarlos0/env" in any of:
	/usr/local/go/src/github.com/caarlos0/env (from $GOROOT)
	/wc2018-slack-bot/src/github.com/caarlos0/env (from $GOPATH)
src/wc2018/match.go:6:2: cannot find package "github.com/google/go-cmp/cmp" in any of:
	/usr/local/go/src/github.com/google/go-cmp/cmp (from $GOROOT)
	/wc2018-slack-bot/src/github.com/google/go-cmp/cmp (from $GOPATH)
src/slack/bot.go:3:8: cannot find package "github.com/nlopes/slack" in any of:
	/usr/local/go/src/github.com/nlopes/slack (from $GOROOT)
	/wc2018-slack-bot/src/github.com/nlopes/slack (from $GOPATH)
Makefile:23: recipe for target 'build' failed
make: *** [build] Error 1

Anyone know what is the cause of this error?

I've solved this issue by hammering those dependencies in the make file. It looks like this:

dc := docker-compose

up:
	$(dc) up -d $${PARAMS}

down:
	$(dc) down

logs:
	@$(dc) logs -f

setup: up deps

deps:
	rm -rf src/vendor
	$(dc) run --rm app sh -c 'cd src && glide install'

deps_get:
	rm -rf src/vendor
	$(dc) run --rm app sh -c "cd src && glide get $${PACKAGE}"

build:
	$(dc) run --rm app sh -c 'go get -u github.com/nlopes/slack;go get -u github.com/google/go-cmp/cmp;go get -u github.com/caarlos0/env;go build -o bin/wc2018-slack-bot src/main/main.go'

run:
	$(dc) run --rm app sh -c "\
	WC2018_POLLING_INTERVAL=$${POLL_INT} \
	WC2018_CURRENT_MATCH_THRESHOLD=$${CURR_TH} \
	WC2018_SLACK_TOKEN=$${TOKEN} \
	WC2018_SLACK_CHANNEL=$${CHANNEL} \
	go run src/main/main.go

This solved the problem. Thanks @helderribeirosousa!

You can also solve it by pointing GOPATH to the repo root dir. This is what I personally do in Goland