exported identifier
A name in Go that starts with a capital letter, which makes it visible to code in other packages.
In more detail
Target and Describe are exported; internalNote is not, so only its own package can use it. The same rule applies to struct fields, which matters for encoding/json because it can only see exported fields. There are no public or private keywords.
Example
func Describe(t Target) string // exported
func internalNote() string // package onlyRelated terms
- Go package — A folder of Go source files that are compiled together and share one package name, which other code imports as a unit.
- struct — A Go type that groups named fields of different types into one value, such as a Target with a Name and a Port.
- encoding/json — Go's standard library package for converting between Go values and JSON text.
- internal package — A package inside a folder called internal, which Go allows only code within the same parent folder tree to import.
Taught in
- Go Workspaces and Modules — Concurrent Systems Programming with Go
- Structs and Methods — Concurrent Systems Programming with Go
- Parsing JSON with encoding/json — Concurrent Systems Programming with Go
- Exporting Results as JSON — Concurrent Systems Programming with Go