# Packages
# README
ADIF Specification for Go
Overview
This repository contains the ADIF specification for Go. It is generated from the export published by the ADIF Workgroup
Using The Library
Import any of the packages in the src/pkg
directory that you wish to use.
Each package has constants related to the ADIF specification.
They use init() to create three package level variables with the following suffixes:
Map
- A map of the ADIF specification for quick lookups.List
- A list of values that are current.ListAll
- A list of all values, including deprecated ones.
For example, to lookup information about a band, we can use the band
package (Run in Go Playground):
package main
import (
"fmt"
"github.com/hamradiolog-net/adif-spec/src/pkg/enum/band"
)
func main() {
forty := band.EnumBandMap[band.Band40m]
fmt.Printf("The 40m band is between %f and %f MHz\n", forty.LowerFreqMHz, forty.UpperFreqMHz)
fmt.Println("Current Bands")
for _, band := range band.EnumBandList {
fmt.Printf("%s: %f - %f\n", band.ID, band.LowerFreqMHz, band.UpperFreqMHz)
}
fmt.Println("All Bands Including Import-Only and Unreleased (usually this is the same as EnumBandList)")
for _, band := range band.EnumBandListAll {
fmt.Printf("%s: %f - %f\n", band.ID, band.LowerFreqMHz, band.UpperFreqMHz)
}
}
Maintenance
The following steps are required to update the specification to the latest version.
-
Download the latest ADIF TSV file exports from the ADIF Workgroup. The current ADIF 3.1.5 spec is kept in the
src/spec/315
directory of this repository. You should rename the folder to the new ADIF version number. -
Update
cmd/specgen/main.go
to use the new TSV folder. -
Add code for any new enumerations to the src/pkg folder being careful to follow the existing style.
-
Run the
generate.sh
script to generate the Go code.
./generate.sh
Testing
./test.sh