“go run vending-machine.go” will only compile that one file. Whereas “go run .” will compile and run all of the .go source files in the directory.
go help run
Run compiles and runs the named main Go package.
Typically the package is specified as a list of .go source files from a single
directory, but it may also be an import path, file system path, or pattern
matching a single known package, as in ‘go run .’ or ‘go run my/cmd’.
Save this file in the same directory as the file where you want to use the function(s). If it’s in a different directory, you’ll need to adjust the import path accordingly.