building storage - Structs - literals
Head First Go、 Jay McGavren(著)、O’Reilly Media)の Chapter 8(building storage - Structs)、p.252(Pool Puzzle)の解答を求めてみる。
コード
main.go
package main
import (
"fmt"
"geo/geo"
)
func main() {
location := geo.Coordinates{Latitude: 37.42, Longitude: -122.08}
fmt.Println("Latitude:", location.Latitude)
fmt.Println("Lontitude:", location.Longitude)
}
入出力結果(Terminal, Zsh)
% go run ./main.go
Latitude: 37.42
Lontitude: -122.08
% tree
.
├── geo
│ └── geo.go
├── go.mod
└── main.go
2 directories, 3 files
% cat go.mod
module geo
go 1.23.4
%