GoDoc...How to use

(Cherolyn Lexvold) #1

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

How can I see the definitions for Arrays and Slices.

(Jos) #2

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.

(Jay Ts) #3

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

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:


(Cherolyn Lexvold) #4

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

(Jay Ts) #5

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.