Go Foundations·Clarity, then concurrency

Syntax, packages and tools

Go favours a small grammar and one obvious formatting style.

Beginner 12 min read Lesson 6 of 300 Challenge included
What you will be able to do
  • Run gofmt on every file; there is no style negotiation.
  • Keep package names short and lowercase.
  • Use := inside functions and var at package scope.

In plain English

Go programs are made of packages. Exported identifiers start with a capital letter. gofmt removes formatting debates; go test runs tests beside the code. Compile errors are part of the feedback loop.

main.goGo
package main

import "fmt"

type Course struct {
    Slug    string
    Lessons int
}

func main() {
    course := Course{Slug: "go", Lessons: 5}
    fmt.Printf("%s has %d lessons\n", course.Slug, course.Lessons)
}
Your turn

Define a lesson

Easy

Create a Lesson struct with Title and Minutes, then print both fields.

GO · starter
type Lesson struct {
}
Check your understanding before moving on.
Knowledge checkQuestion 1

What does an exported Go identifier start with?

Select an answer to continue
Study tools

Make it yours.

Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.

Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign in
Finished reading?

Lock in what you just learned.

Mark this lesson complete to save your place and move one step closer to the certificate.

Next: Functions and errors
Lesson 6 of 300 · 0% of course