Comments (4)
Please try running it with the script provided, like I have (../shell/go). Most likely, the #!/bin/bash line is needed and I'll have to amend the instructions in the book. Something like this:
cp shell/go /usr/local/bin/docker-go
docker-go run hello_world.go
from books.
There's a "run" script provided in the same chapter1 folder, which works for me:
$ ./run
== go run hello_world.go ==
Hello world!
Which exact docker run command are you running? I'll check the ch1 in the book, perhaps I just need to fix some slightly older example.
Edit: It seems the docker run example in ch1 is okay. I put the same snippets under scripts and tried to run hello world from a script as suggested, and from the expanded docker run command:
$ ../shell/go run hello_world.go
Hello world!
$ docker run --rm=true -it -v `pwd`:/go/src/app -w /go/src/app golang go run hello_world.go
Hello world!
I pushed the "go" script which I mentioned/referenced, but generally you can go into every sample directory and just execute "run" scripts. You can paste exactly which command you are executing so I can spot the issue.
from books.
In ch1 under "Setting up a runner for your Go programs" there are these instructions -
$ docker run --net=party -p 8080:80 --rm=true -it -v `pwd`:/go/src/app -w /go/sr\
c/app golang go "$@"
Save this code snippet as the file ‘go’, make it executable and copy it to your execution path (usually
/usr/local/bin is reserved for things like this).
Using that code snippet to run the hello_world.go
is causing the error. I have put it in my path but I run it as docker-go
so that I can switch between the two. Using the default go
prints Hello World
.
With the new script in ../shell/common.sh/
there are no errors but Hello World
is not being printed to the screen.
In terms of my setup I'm running Linux Mint 17 and Fish shell but I have also tried the commands in bash with the same results.
from books.
You're right - I added #!/bin/bash
to the docker script and now both it and ./run
are printing Hello World
in bash and fish shell. For consistency I amended the run
script as follows:
#!/bin/bash
source ../shell/common.sh
APP="foundations"
FILES=$(ls *.go | sort)
for FILE in $FILES; do
docker-go.sh run $FILE
done
Thanks for your help
from books.
Related Issues (3)
- Chapter4b JWT HOT 3
- chapter4b-jwt/jwt.go HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from books.