Everyone has to see this new Windows compiler. Beta test started today. Strongly recommended!
http://www.newquistsolutions.com/ergo
This is a blog that is associated with my website, www.goprogrammingbook.com. I am not associated directly with Google, except that I use many of their products. :)
Tuesday, November 9, 2010
Monday, October 11, 2010
Busy, busy!
Well, it's been a wee bit of time since I've posted, so I thought I'd update everyone. I'm currently teaching two classes at the university, working 40 hours a week, and taking a course toward my Ph.D. while working on a couple side projects. Needless to say, it's quite busy!
However, the book seems to be very popular and I thank everyone for their support. As always, if you find errors, need for clarification, or have any comments pertaining to the book, check out goprogrammingbook.com to see if it's answered already, and e-mail me at : goprogrammingbook@gmail.com if you have anything to say!
Thanks, and have a great day!
However, the book seems to be very popular and I thank everyone for their support. As always, if you find errors, need for clarification, or have any comments pertaining to the book, check out goprogrammingbook.com to see if it's answered already, and e-mail me at : goprogrammingbook@gmail.com if you have anything to say!
Thanks, and have a great day!
Thursday, September 16, 2010
Run Go Code in your Browser
Now you can play around with Go in your browser!
http://golang.org/doc/play/
Thanks to Joe Ciarrocchi for pointing this out to me!
http://golang.org/doc/play/
Thanks to Joe Ciarrocchi for pointing this out to me!
Monday, August 2, 2010
Go : TIOBE 2009 Language of the Year
Only two months after it was release, Go was named the TIOBE (http://www.tiobe.com) "Language of the Year". That's quite an accomplishment.
Tuesday, July 27, 2010
Barnes and Noble
I'm pleased to announce that Go Programming is now available at Barnes and Noble's website :
http://search.barnesandnoble.com/books/e/9781453636671/?itm=2&USRI=go+programming
Also, it is available by special order in store. Tell your local B&N that they should keep a couple copies in stock!
Thanks,
John
http://search.barnesandnoble.com/books/e/9781453636671/?itm=2&USRI=go+programming
Also, it is available by special order in store. Tell your local B&N that they should keep a couple copies in stock!
Thanks,
John
Wednesday, July 7, 2010
Search Inside Now Available at Amazon!
Finally, the Search Inside feature has been enabled for my book. Check it out now!
http://www.amazon.com/Go-Programming-John-P-Baugh/dp/1453636676/ref=sr_1_1?ie=UTF8&s=books&qid=1277418225&sr=1-1
There is a lot of good information in the book. I hope everyone who has purchased it is enjoying it! Remember to check out the book's official site and e-mail me any errors, questions, or anything at all related to the book!
http://www.goprogrammingbook.com/
Thanks!
http://www.amazon.com/Go-Programming-John-P-Baugh/dp/1453636676/ref=sr_1_1?ie=UTF8&s=books&qid=1277418225&sr=1-1
There is a lot of good information in the book. I hope everyone who has purchased it is enjoying it! Remember to check out the book's official site and e-mail me any errors, questions, or anything at all related to the book!
http://www.goprogrammingbook.com/
Thanks!
Sunday, July 4, 2010
Back from vacation
Well, that was an enjoyable family reunion over the weekend. Saw a lot of people I hadn't seen in years, and some cousins (younger ones) I had never even met before. I'm officially old.
Walked a trail (that was labeled 2.75 miles) with my cousin Garrett (who was in diapers that last time I saw him. Now he's 11. Again, I'm officially old.) I thought it was going to be reasonably short trail. It's not uncommon for me to run/travel 2.00 miles or so on the treadmill or elliptical machine at the gym every day, so 2.75 miles didn't sound like that long.
Well, it took a very long time. We helped a biker in a ditch, nearly tripped down a couple very steep slopes, and basically thought we were lost in the wilderness. We kept chugging along and finally made it out of the woods. After close inspection of the map near the trail, I realized we essentially went straight when we should have turned and thus added about a mile to our trip. It was fun though.
Anywho, back to the crazy and fantastic world of programming and coding! :)
Walked a trail (that was labeled 2.75 miles) with my cousin Garrett (who was in diapers that last time I saw him. Now he's 11. Again, I'm officially old.) I thought it was going to be reasonably short trail. It's not uncommon for me to run/travel 2.00 miles or so on the treadmill or elliptical machine at the gym every day, so 2.75 miles didn't sound like that long.
Well, it took a very long time. We helped a biker in a ditch, nearly tripped down a couple very steep slopes, and basically thought we were lost in the wilderness. We kept chugging along and finally made it out of the woods. After close inspection of the map near the trail, I realized we essentially went straight when we should have turned and thus added about a mile to our trip. It was fun though.
Anywho, back to the crazy and fantastic world of programming and coding! :)
Thursday, July 1, 2010
Holiday Weekend
Greetings all,
A Happy Canada Day to my Canadian fans, and a Happy Independence Day to my fellow Americans. May I suggest my book available for purchase HERE as a wonderful holiday gift for that special programmer in your life? :)
I'll be out of town for the weekend, so it will be unlikely I will be posting here or checking my e-mail until later Sunday night. I hope all of you have a safe weekend! Celebrate responsibly!
A Happy Canada Day to my Canadian fans, and a Happy Independence Day to my fellow Americans. May I suggest my book available for purchase HERE as a wonderful holiday gift for that special programmer in your life? :)
I'll be out of town for the weekend, so it will be unlikely I will be posting here or checking my e-mail until later Sunday night. I hope all of you have a safe weekend! Celebrate responsibly!
Monday, June 28, 2010
Installing Go on Windows
While the Go port on Windows is not as full featured as it is for the Linux(es) or MacOS, it is still very useful to try it out on a Windows machine. In fact, for the Go language to become more and more popular, it would be very helpful if more people become involved with the Windows Go development community.
To install Go on Windows, you must:
1.) Download the binaries from the Go MinGW Builds page.
2.) Extract the binaries to a location that you can remember or that you will copy onto a clipboard. The folder containing the binaries will be called go. This go directory will contain various subdirectories (sub folders), including a subdirectory called bin, which holds the binaries (including the compiler, 8g, and the linker, 8l)
3.) Next, you should set up the various environment variables. On Windows 7, this would involve going to Start --> Hover over Computer and Right-Click --> Go to Properties
Once you're at the Properties, you go to Advanced System Settings, then click on Environment Variables.
4.) In the Environment Variables, add the following SYSTEM environment variables (by clicking on "New" for each of them, putting the name of the variable (in bold) and then putting the value specified (in italics):
- GOBIN C:\directory you put the go binaries in\go\bin
- GOARCH 386
- GOOS windows
- GOROOT C:\directory you put the go binaries in \go
Now, in order for the command line compilation to work, you have to add the GOBIN to your PATH environment variable.
To do this, find Path in the system environment variables. Edit it. Go to the end of the Path and add a semicolon, followed by %GOBIN% thusly:
somestuff;%GOBIN%
The %GOBIN% will resolve the place where you put the Go binaries, as you specified in another environment variable. This is what the percentage signs are for. They resolve the environment variable to the directory you put the binaries in. Make sure to save your changes appropriately at each step.
5.) Try out Go in a command line now. You should be able to write a source file and then try using the 8g and 8l commands. For example, write a small program in Notepad, save it as test1.go and put it where you'll remember it.
Then,
C:\workdir>8g test1.go
C:\workdir>8l test1.8
Then, you should be able to start the new executable, which if you didn't change the name using the -o option, should be:
C:\workdir>8.out.exe
Try it!
To install Go on Windows, you must:
1.) Download the binaries from the Go MinGW Builds page.
2.) Extract the binaries to a location that you can remember or that you will copy onto a clipboard. The folder containing the binaries will be called go. This go directory will contain various subdirectories (sub folders), including a subdirectory called bin, which holds the binaries (including the compiler, 8g, and the linker, 8l)
3.) Next, you should set up the various environment variables. On Windows 7, this would involve going to Start --> Hover over Computer and Right-Click --> Go to Properties
Once you're at the Properties, you go to Advanced System Settings, then click on Environment Variables.
4.) In the Environment Variables, add the following SYSTEM environment variables (by clicking on "New" for each of them, putting the name of the variable (in bold) and then putting the value specified (in italics):
- GOBIN C:\directory you put the go binaries in\go\bin
- GOARCH 386
- GOOS windows
- GOROOT C:\directory you put the go binaries in \go
Now, in order for the command line compilation to work, you have to add the GOBIN to your PATH environment variable.
To do this, find Path in the system environment variables. Edit it. Go to the end of the Path and add a semicolon, followed by %GOBIN% thusly:
somestuff;%GOBIN%
The %GOBIN% will resolve the place where you put the Go binaries, as you specified in another environment variable. This is what the percentage signs are for. They resolve the environment variable to the directory you put the binaries in. Make sure to save your changes appropriately at each step.
5.) Try out Go in a command line now. You should be able to write a source file and then try using the 8g and 8l commands. For example, write a small program in Notepad, save it as test1.go and put it where you'll remember it.
Then,
C:\workdir>8g test1.go
C:\workdir>8l test1.8
Then, you should be able to start the new executable, which if you didn't change the name using the -o option, should be:
C:\workdir>8.out.exe
Try it!
Saturday, June 26, 2010
Import Statements
Importing packages is key to using a lot of the useful functionality available with Go. An import statement can be used with either single line syntax, or with a shortcut multi-line syntax.
Single Line example:
import "fmt"
import "os"
In the shortcut format, this is:
import
(
"fmt"
"os"
)
or:
import(
"fmt"
"os"
)
Notice that you don't have to put the opening parenthesis on the same line as the import keyword. They are not the same as curly braces.
This may not seem like much of a shortcut, but consider importing six or seven libraries (or more). Having to retype import all the time can get a bit tiresome, and is really unnecessary.
Another really cool thing about importing with Go is that the compiler won't let you import a package that you aren't using.
Consider the following:
package main
import
(
"os"
"fmt"
)
func main(){
fmt.Printf("How's it going there?");
}
This will generate an error and you can't compile the program. Why? Because you imported the os package and didn't use it.
Single Line example:
import "fmt"
import "os"
In the shortcut format, this is:
import
(
"fmt"
"os"
)
or:
import(
"fmt"
"os"
)
Notice that you don't have to put the opening parenthesis on the same line as the import keyword. They are not the same as curly braces.
This may not seem like much of a shortcut, but consider importing six or seven libraries (or more). Having to retype import all the time can get a bit tiresome, and is really unnecessary.
Another really cool thing about importing with Go is that the compiler won't let you import a package that you aren't using.
Consider the following:
package main
import
(
"os"
"fmt"
)
func main(){
fmt.Printf("How's it going there?");
}
This will generate an error and you can't compile the program. Why? Because you imported the os package and didn't use it.
Friday, June 25, 2010
Short Declarations
The book has just started to sell, and I am going to point out one thing that some Go purists may find frustrating: I don't use short declarations extensively in the book. They may think that this somewhat violates the whole purpose of the language : to be able to do things quickly.
However, I don't believe this is the case. The book does clarify that you can use short declarations, but I prefer to show how to do things the long way because that is the one that the beginners may find most difficult. The syntax is somewhat "backwards" of what they may expect.
Let's say I want to declare an integer and assign a value to it. If I use short declarative form, this is:
a := 5;
or even shorter
a:= 5
(no semicolon).
This is all fine and dandy, but is not very self-documenting of the variable a. One could argue that simply using a more useful name like numberOfCows or whatever describes the variable's purpose is the solution. I agree to an extent. This is most helpful, especially with primitive data types. But this can get remarkably confusing when the data types are not as clear cut, like various similar custom data types.
Regardless, for the book I chose to show the long declarations because these are self-documenting and if the reader doesn't like long declarations, they can feel free to create their program in short declarative form. There's no harm in declaring an integer variable (or any variable of any other data type) this way:
var a int;
a = 5;
So, pick your poison! Choose whichever feels best for you. The writability of Go is improved by using short declarations, but not necessarily the overall readability, in my opinion.
However, I don't believe this is the case. The book does clarify that you can use short declarations, but I prefer to show how to do things the long way because that is the one that the beginners may find most difficult. The syntax is somewhat "backwards" of what they may expect.
Let's say I want to declare an integer and assign a value to it. If I use short declarative form, this is:
a := 5;
or even shorter
a:= 5
(no semicolon).
This is all fine and dandy, but is not very self-documenting of the variable a. One could argue that simply using a more useful name like numberOfCows or whatever describes the variable's purpose is the solution. I agree to an extent. This is most helpful, especially with primitive data types. But this can get remarkably confusing when the data types are not as clear cut, like various similar custom data types.
Regardless, for the book I chose to show the long declarations because these are self-documenting and if the reader doesn't like long declarations, they can feel free to create their program in short declarative form. There's no harm in declaring an integer variable (or any variable of any other data type) this way:
var a int;
a = 5;
So, pick your poison! Choose whichever feels best for you. The writability of Go is improved by using short declarations, but not necessarily the overall readability, in my opinion.
Where I am on the web
Well, the Go Programming book now has its own Twitter page:
http://twitter.com/goprogbook
and its own Facebook page:
Go Programming Book by J.P. Baugh
Come follow!
http://twitter.com/goprogbook
and its own Facebook page:
Go Programming Book by J.P. Baugh
Come follow!
Thursday, June 24, 2010
Programming Go If You Have Windows
It's a frequently asked question. What do you do if you have a Windows machine? After all, at this point in time, the only fully supported ports of Go are for Mac OS and Linux.
Well, there is an active community involved on porting it to Windows under MinGW.
Check it out HERE .
Another alternative, since the MinGW port isn't completed yet would be to install Ubuntu (one of many flavors of Linux) on your Windows box. This sounds daunting. You don't even have to go through partitioning or anything complicated or potentially dangerous to your file system. You can use a handy-dandy little tool called the Windows Ubuntu Installer, or Wubi for short.
Get Wubi HERE.
Once you have Ubuntu installed using Wubi, it will allow you to choose Ubuntu on your Windows box at startup. Don't worry. If you choose this option, Windows isn't really in any danger, but the Ubuntu installation can be a bit fragile and sensitive to things like hard reboots. But it's a sinch to reinstall if you have something goofy go on. It also uninstalls easily.
Well, there is an active community involved on porting it to Windows under MinGW.
Check it out HERE .
Another alternative, since the MinGW port isn't completed yet would be to install Ubuntu (one of many flavors of Linux) on your Windows box. This sounds daunting. You don't even have to go through partitioning or anything complicated or potentially dangerous to your file system. You can use a handy-dandy little tool called the Windows Ubuntu Installer, or Wubi for short.
Get Wubi HERE.
Once you have Ubuntu installed using Wubi, it will allow you to choose Ubuntu on your Windows box at startup. Don't worry. If you choose this option, Windows isn't really in any danger, but the Ubuntu installation can be a bit fragile and sensitive to things like hard reboots. But it's a sinch to reinstall if you have something goofy go on. It also uninstalls easily.
Curly Brace { } Mayhem
Programmers and enthsiasts new to Go may find the curly brace syntax requirements to be a bit unusual. Misplacing the opening curly brace in functions and other programming structures is a very common mistake.
Let's examine this a little closer:
func main()
{
}
will generate an error, because for programming elements like functions, Go inserts a semicolon after the closing parenthesis. Thus, this is what the compiler actually sees:
func main();
{
}
which is obviously a syntax error.
To prevent this, make sure that you put the opening curly brace on the same line as the function header, as follows:
func main(){
}
With the above syntax template, the program will compile with no problem!
Let's examine this a little closer:
func main()
{
}
will generate an error, because for programming elements like functions, Go inserts a semicolon after the closing parenthesis. Thus, this is what the compiler actually sees:
func main();
{
}
which is obviously a syntax error.
To prevent this, make sure that you put the opening curly brace on the same line as the function header, as follows:
func main(){
}
With the above syntax template, the program will compile with no problem!
Welcome to my Go Programming Blog!
Well, I recently published my book, Go Programming and it is currently available on Amazon, and should be available soon at your local book store. I hope that it helps many people get up and running with this excellent language. I will be posting some information about my experience(s) with the language here, as well as (hopefully) helpful tutorials and information.
Subscribe to:
Posts (Atom)