wardviaene / golang-for-devops-course

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Need to instruct go to use the current directory for the test-server

fernandino143 opened this issue · comments

When first starting the test-server, this is showing up:

$ go run *.go
main.go:16:2: no required module provides package github.com/golang-jwt/jwt/v4: go.mod file not found in current directory or any parent directory; see 'go help modules'

The quick-fix for this would be running golang-for-devops-course/test-server (main) $ go work use . in case the project/folder is inside a workspace within vscode.

Since 1.18 you can use multi-module workspaces. It's also supported in VSCode, so opening the main repo will look for a go.work file to list all the submodules. I've added the go.work file, so now you should be able to run it without problems if you open the git repository within vscode. Make sure to do a pull to get the latest changes. Running test-server should be as easy as "go run ./test-server" from the main directory. See also https://go.dev/doc/tutorial/workspaces for more info about workspaces