Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

Commit

Permalink
Switch to 'revive'
Browse files Browse the repository at this point in the history
  • Loading branch information
paultag committed May 26, 2023
1 parent 5b0eab2 commit d8739b7
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ check: lint
clean:

lint:
golint ./...
revive ./...

.PHONY: all lint check

Expand Down
26 changes: 13 additions & 13 deletions hz.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,39 +71,39 @@ func (h *Hz) UnmarshalYAML(unmarshal func(interface{}) error) error {

var (
// KHz represents one kilohertz, or 1,000 Hz
KHz Hz = Hz(1e+3)
KHz = Hz(1e+3)

// MHz represents one megahertz, or 1,000,000 Hz
MHz Hz = Hz(1e+6)
MHz = Hz(1e+6)

// GHz represents one gigahertz, or 1,000,000,000 Hz
GHz Hz = Hz(1e+9)
GHz = Hz(1e+9)

// THz represents one terrahertz, or 1,000,000,000,000 Hz
THz Hz = Hz(1e+12)
THz = Hz(1e+12)

// KHzBand represents the Kilohertz band, from 1KHz up to 1MHz.
KHzBand Allocation = Allocation{Name: "KHz", Range: Range{KHz, MHz - 1}}
KHzBand = Allocation{Name: "KHz", Range: Range{KHz, MHz - 1}}

// MHzBand represents the Megahertz band, from 1MHz up to 1GHz.
MHzBand Allocation = Allocation{Name: "MHz", Range: Range{MHz, GHz - 1}}
MHzBand = Allocation{Name: "MHz", Range: Range{MHz, GHz - 1}}

// GHzBand represents the Gigahertz band, from 1GHz up to 1THz.
GHzBand Allocation = Allocation{Name: "GHz", Range: Range{GHz, THz - 1}}
GHzBand = Allocation{Name: "GHz", Range: Range{GHz, THz - 1}}

// SIBands represents the Hz-based allocations (KHz, MHz, GHz)
SIBands Allocations = Allocations{KHzBand, MHzBand, GHzBand}
SIBands = Allocations{KHzBand, MHzBand, GHzBand}
)

// String will convert the frequency into a string, able to be re-parsed as
// a frequency, or displayed to a user.
func (h Hz) String() string {
var (
frequency float64 = float64(h)
fkhz float64 = float64(KHz)
steps uint = 0
neg bool = h < 0
sign string = ""
frequency = float64(h)
fkhz = float64(KHz)
steps uint
neg = h < 0
sign = ""
)

if neg {
Expand Down
46 changes: 23 additions & 23 deletions itu.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,63 +20,63 @@

package rf

var ituELF Hz = Hz(3)
var ituSLF Hz = Hz(3e+1)
var ituULF Hz = Hz(3e+2)
var ituVLF Hz = Hz(3e+3)
var ituLF Hz = Hz(3e+4)
var ituMF Hz = Hz(3e+5)
var ituHF Hz = Hz(3e+6)
var ituVHF Hz = Hz(3e+7)
var ituUHF Hz = Hz(3e+8)
var ituSHF Hz = Hz(3e+9)
var ituEHF Hz = Hz(3e+10)
var ituTHF Hz = Hz(3e+11)
var ituELF = Hz(3)
var ituSLF = Hz(3e+1)
var ituULF = Hz(3e+2)
var ituVLF = Hz(3e+3)
var ituLF = Hz(3e+4)
var ituMF = Hz(3e+5)
var ituHF = Hz(3e+6)
var ituVHF = Hz(3e+7)
var ituUHF = Hz(3e+8)
var ituSHF = Hz(3e+9)
var ituEHF = Hz(3e+10)
var ituTHF = Hz(3e+11)

var (
// ELFBand or Extremely Low Frequency, is a slice of RF space defined by the ITU
// as being between 3Hz and 30Hz
ELFBand Allocation = Allocation{Name: "ELF", Range: Range{ituELF, ituSLF - 1}}
ELFBand = Allocation{Name: "ELF", Range: Range{ituELF, ituSLF - 1}}

// SLFBand or Super Low Frequency, is a slice of RF space defined by the ITU
// as being between 30Hz and 300Hz
SLFBand Allocation = Allocation{Name: "SLF", Range: Range{ituSLF, ituULF - 1}}
SLFBand = Allocation{Name: "SLF", Range: Range{ituSLF, ituULF - 1}}

// ULFBand or Ultra Low Frequency, is a slice of RF space defined by the ITU
// as being between 300Hz and 3KHz
ULFBand Allocation = Allocation{Name: "ULF", Range: Range{ituULF, ituVLF - 1}}
ULFBand = Allocation{Name: "ULF", Range: Range{ituULF, ituVLF - 1}}

// VLFBand or Very Low Frequency, is a slice of RF space defined by the ITU
// as being between 3KHz and 30KHz
VLFBand Allocation = Allocation{Name: "VLF", Range: Range{ituVLF, ituLF - 1}}
VLFBand = Allocation{Name: "VLF", Range: Range{ituVLF, ituLF - 1}}

// LFBand or Low Frequency, is a slice of RF space defined by the ITU
// as being between 30KHz and 300KHz
LFBand Allocation = Allocation{Name: "LF", Range: Range{ituLF, ituMF - 1}}
LFBand = Allocation{Name: "LF", Range: Range{ituLF, ituMF - 1}}

// MFBand or Medium Frequency, is a slice of RF space defined by the ITU
// as being between 300KHz and 3MHz
MFBand Allocation = Allocation{Name: "MF", Range: Range{ituMF, ituHF - 1}}
MFBand = Allocation{Name: "MF", Range: Range{ituMF, ituHF - 1}}

// HFBand or High Frequency, is a slice of RF space defined by the ITU
// as being between 3MHz and 30MHz
HFBand Allocation = Allocation{Name: "HF", Range: Range{ituHF, ituVHF - 1}}
HFBand = Allocation{Name: "HF", Range: Range{ituHF, ituVHF - 1}}

// VHFBand or Very High Frequency, is a slice of RF space defined by the ITU
// as being between 30MHz and 300MHz
VHFBand Allocation = Allocation{Name: "VHF", Range: Range{ituVHF, ituUHF - 1}}
VHFBand = Allocation{Name: "VHF", Range: Range{ituVHF, ituUHF - 1}}

// UHFBand or Ultra High Frequency, is a slice of RF space defined by the ITU
// as being between 300MHz and 3GHz
UHFBand Allocation = Allocation{Name: "UHF", Range: Range{ituUHF, ituSHF - 1}}
UHFBand = Allocation{Name: "UHF", Range: Range{ituUHF, ituSHF - 1}}

// SHFBand or Super High Frequency, is a slice of RF space defined by the ITU
// as being between 3GHz and 30GHz
SHFBand Allocation = Allocation{Name: "SHF", Range: Range{ituSHF, ituEHF - 1}}
SHFBand = Allocation{Name: "SHF", Range: Range{ituSHF, ituEHF - 1}}

// EHFBand or Extremely High Frequency, is a slice of RF space defined by the ITU
// as being between 30GHz and 300GHz
EHFBand Allocation = Allocation{Name: "EHF", Range: Range{ituEHF, ituTHF - 1}}
EHFBand = Allocation{Name: "EHF", Range: Range{ituEHF, ituTHF - 1}}

// ITUBands represents all the ITU allocated RF bands.
//
Expand Down

0 comments on commit d8739b7

Please sign in to comment.