Skip to content

Commit

Permalink
even more linting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bluntelk committed Nov 12, 2023
1 parent 0c2f15d commit 20770d4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
1 change: 0 additions & 1 deletion lib/export/location.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,4 @@ func (pl *PlaneLocation) ToJsonBytes() ([]byte, error) {
} else {
return jsonBuf, nil
}

}
32 changes: 16 additions & 16 deletions lib/export/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,27 @@ type (
// PlaneLocation is our exported data format. it encodes to JSON
PlaneLocation struct {
// This info is populated by the tracker
New bool
Removed bool
Icao string
Lat float64
Lon float64
Heading float64
Velocity float64
Altitude int
VerticalRate int
AltitudeUnits string
FlightStatus string
New bool
Removed bool
OnGround bool
Airframe string
AirframeType string
HasAltitude bool
HasLocation bool
HasHeading bool
HasOnGround bool
HasFlightStatus bool
HasVerticalRate bool
HasVelocity bool
AltitudeUnits string
FlightStatus string
Airframe string
AirframeType string
SourceTag string
Squawk string
Special string
Expand Down Expand Up @@ -101,11 +101,11 @@ var (

// Plane here gives us something to look at
func (pl *PlaneLocation) Plane() string {
if nil != pl.CallSign && "" != *pl.CallSign {
if nil != pl.CallSign && *pl.CallSign != "" {
return *pl.CallSign
}

if nil != pl.Registration && "" != *pl.Registration {
if nil != pl.Registration && *pl.Registration != "" {
return *pl.Registration
}

Expand Down Expand Up @@ -203,23 +203,23 @@ func MergePlaneLocations(prev, next PlaneLocation) (PlaneLocation, error) {
merged.OnGround = next.OnGround
merged.Updates.OnGround = next.Updates.OnGround
}
if "" == merged.Airframe {
if merged.Airframe == "" {
merged.Airframe = next.Airframe
}
if "" == merged.AirframeType {
if merged.AirframeType == "" {
merged.AirframeType = next.AirframeType
}

if "" != unPtr(next.Registration) {
if unPtr(next.Registration) != "" {
merged.Registration = ptr(unPtr(next.Registration))
}
if "" != unPtr(next.CallSign) {
if unPtr(next.CallSign) != "" {
merged.CallSign = ptr(unPtr(next.CallSign))
}
merged.SourceTag = "merged"

if next.Updates.Squawk.After(prev.Updates.Squawk) {
if `0` == next.Squawk {
if next.Squawk == `0` {
// setting 0 as the squawk is valid, just when we have badly timed data it can jump around
// only update to 0 *if* it's been a few seconds to account for delayed feeds
if next.Updates.Squawk.After(prev.Updates.Squawk.Add(5 * time.Second)) {
Expand All @@ -237,14 +237,14 @@ func MergePlaneLocations(prev, next PlaneLocation) (PlaneLocation, error) {
merged.Updates.Special = next.Updates.Special
}

if "" != next.TileLocation {
if next.TileLocation != "" {
merged.TileLocation = next.TileLocation
}

if 0 != unPtr(next.AircraftWidth) {
if unPtr(next.AircraftWidth) != 0 {
merged.AircraftWidth = ptr(unPtr(next.AircraftWidth))
}
if 0 != unPtr(next.AircraftLength) {
if unPtr(next.AircraftLength) != 0 {
merged.AircraftLength = ptr(unPtr(next.AircraftLength))
}

Expand Down

0 comments on commit 20770d4

Please sign in to comment.