adif-spec

module
v1.0.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2025 License: BSD-3-Clause

README

ADIF 3.1.5 Specification Library for Go

Tests Go Report Card Go Reference Go Version License

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 Suffix - A map of the ADIF specification for quick lookups.
    • *.List Suffix - A list of values that are current.
    • *.ListAll Suffix - 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.

  1. 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 match the new ADIF version number.

  2. Update cmd/specgen/main.go and related code to use the new TSV folder.

  3. Add code for any new enumerations to the src/pkg folder being careful to follow the existing style.

  4. Run go generate ./... to re-generate the Go code.

go generate ./...
Testing
go test ./...

If you found this library useful, you may also be interested in the following projects:

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL