GoDoc...How to use

When I connect to
goDoc, I get https://godoc.org/

How can I see the definitions for Arrays and Slices.

You can find information on arrays and slices in the Go language specification: arrays, slices.

There are also helpful blog posts on those types on golang.org, like this one.

1 Like

Hi Cherolyn,

The godoc.org website is about documentation of Go packages, mostly ones that are not part of the official Go package library.

There is a go doc command that you can use if you have Go installed on your computer. It provides quick access (faster than going to the golang.org website) to documentation about packages and their contents. For example,

$ go doc fmt.Printf
func Printf(format string, a …interface{}) (n int, err error)
Printf formats according to a format specifier and writes to standard
output. It returns the number of bytes written and any write error
encountered.

If you want to learn about arrays and slices, I suggest you look in an introductory book on Go or some similar resource. Here are two:

https://gobyexample.com/arrays
https://www.miek.nl/go/#arrays-slices-and-maps

1 Like

Thanks! Can’t wait to check this out. Out of time.

Hi Cherolyn,

It’s important to learn about arrays because slices are based on them. Slices are very important to learn well because it is a basic way that Go allows efficient access to the computer’s memory in the way that the computer is designed to work, by stepping through successive memory locations. This is a way that programming in a compiled language helps human thinking meet the way that electronic machines function.

2 Likes

I believe I installed Go on my computer. Do you have any idea where I would find it or what it would look lie? I’m on hold with Apple. She is trying to help me find it.

1 Like

Thanks!

Is it called go-programming-master?

Hi Cherolyn,

Did you follow the instructions from the Go website?

If so, then you should have a /usr/local/go directory, and if you open a terminal and type the command

go version

(followed by the Return key, of course.)

It will print something that looks like this

go version go1.11 linux/amd64

but it will say something else (like darwin or macos) instead of linux. The important thing is that the go version command runs, and you don’t get an error saying it can’t find the go command, or something like that. If it works, then you have probably installed Go correctly, and the next step is to use the terminal and a text editor so you can write programs, then compile and run them.

I think I did install it, but I don’t know where to find it.

Maybe the question is, how do I find the terminal?

Two ways

  1. press command-key and space and search for terminal

or

  1. Click on the desktop.And then In the menu bar on top of the screen there is a menu called Go. In this it you can select Utilities and in that folder will you find Terminal.

I’m not at my Mac at the moment and if there is no Utilities in the Go menu. Do select Applications and then in that folder will you find Utilities and inside that Terminal.

Good luck

1 Like

Hi Cherolyn,

Follow Johan’s directions to get the Terminal (actually the Bash shell) started. Then search the web, especially YouTube, to find a bash tutorial you like. A search string like “bash tutorial beginner” will bring up many results. Unfortunately, most are aimed at a not-complete-beginner level, and many are not very good. It may take you a while to find the one that is best for you. Don’t give up.

I hope I don’t get myself in trouble for saying this, but one of my favorite tutorials on the shell is Steve Bourne’s tutorial that was part of the documentation of UNIX in the late 1970’s. If you don’t mind going into a time machine, try this:

http://stat.wharton.upenn.edu/~buja/STAT-540/shell-Bourne-An-Introduction-to-the-Unix-Shell.htm

This is how I got started. It was the only documentation on the shell available at the time, and I’ve been really grateful how well Steve Bourne wrote it. Not all of the commands in the tutorial will work on your Mac, and some examples are outdated because things are done differently nowadays. Still, it is still a good overview of the shell. Bash (the “Bourne-Again Shell”) is based on the Bourne shell, but has many more features.

Have some fun learning basic shell commands and features, and get used to how it works. Just be careful not to destroy anything. Stay in your home directory area while doing operations that create, modify, or delete files until you develop your skill with it.

Bash is a “computing power tool”, and it’s even a programming language (although not the nicest!). It can be really fun to use and you can do a lot with it.

1 Like

I am so ignorant (no criticism here, just fact).
What am I looking at when I press command-key and space. Because I did it from here, in this forum, and nothing happened.
For 2., Yay! I found it! Thanks!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.