Skip to content

Commit 462783c

Browse files
committed
lint
1 parent a4dd218 commit 462783c

File tree

10 files changed

+28
-75
lines changed

10 files changed

+28
-75
lines changed

Proj.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ type Projector struct {
2222

2323
// New creates a Projector object for the given soure and destination systems.
2424
func New(sourceEPSG, destEPSG int) (*Projector, error) {
25-
pair := pair{sourceEPSG, destEPSG}
26-
str, ok := knownProjections[pair]
25+
codes := pair{sourceEPSG, destEPSG}
26+
str, ok := knownProjections[codes]
2727
if !ok {
2828
return nil, fmt.Errorf("epsg code pair is not a supported projection")
2929
}
@@ -43,7 +43,7 @@ func New(sourceEPSG, destEPSG int) (*Projector, error) {
4343
}
4444

4545
proj := &Projector{
46-
pair: pair,
46+
pair: codes,
4747
projString: ps,
4848
system: sys,
4949
operation: opx,

core/Ellipsoid.go

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,7 @@ func (e *Ellipsoid) initialize(op *System) error {
8787
if err != nil {
8888
return err
8989
}
90-
err = e.doCalcParams(e.A, 0)
91-
if err != nil {
92-
return err
93-
}
94-
return nil
90+
return e.doCalcParams(e.A, 0)
9591
}
9692

9793
/* If an ellps argument is specified, start by using that */
@@ -119,21 +115,7 @@ func (e *Ellipsoid) initialize(op *System) error {
119115
}
120116

121117
/* And finally, we may turn it into a sphere */
122-
err = e.doSpherification(op.ProjString)
123-
if err != nil {
124-
return err
125-
}
126-
127-
//proj_log_debug (P, "pj_ellipsoid - final: a=%.3f f=1/%7.3f, errno=%d",
128-
// P->a, P->f!=0? 1/P->f: 0, proj_errno (P));
129-
//proj_log_debug (P, "pj_ellipsoid - final: %s %s %s %s",
130-
// P->def_size? P->def_size: empty,
131-
// P->def_shape? P->def_shape: empty,
132-
// P->def_spherification? P->def_spherification: empty,
133-
// P->def_ellps? P->def_ellps: empty );
134-
135-
/* success */
136-
return nil
118+
return e.doSpherification(op.ProjString)
137119
}
138120

139121
func (e *Ellipsoid) doCalcParams(a float64, es float64) error {
@@ -241,12 +223,7 @@ func (e *Ellipsoid) doEllps(ps *support.ProjString) error {
241223
return err
242224
}
243225

244-
err = e.doShape(newPS)
245-
if err != nil {
246-
return err
247-
}
248-
249-
return nil
226+
return e.doShape(newPS)
250227
}
251228

252229
func (e *Ellipsoid) doSize(ps *support.ProjString) error {
@@ -500,10 +477,5 @@ func (e *Ellipsoid) doSpherification(ps *support.ProjString) error {
500477
P.Rf = math.MaxFloat64
501478
P.B = P.A
502479

503-
err := e.doCalcParams(P.A, 0)
504-
if err != nil {
505-
return err
506-
}
507-
508-
return nil
480+
return e.doCalcParams(P.A, 0)
509481
}

core/System.go

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -221,21 +221,7 @@ func (sys *System) initialize() error {
221221
sys.DatumType = DatumTypeWGS84
222222
}
223223

224-
err = sys.processMisc()
225-
if err != nil {
226-
return err
227-
}
228-
229-
/*
230-
// do setup work specific to this operation
231-
// (locate_constructor)
232-
err = op.Info.setup(op)
233-
if err != nil {
234-
return err
235-
}
236-
*/
237-
238-
return nil
224+
return sys.processMisc()
239225
}
240226

241227
func (sys *System) processDatum() error {
@@ -483,14 +469,7 @@ func (sys *System) processMisc() error {
483469
return err
484470
}
485471

486-
err = sys.processMeridian()
487-
if err != nil {
488-
return err
489-
}
490-
491-
// TODO: geod_init(PIN->geod, PIN->a, (1 - sqrt (1 - PIN->es)));
492-
493-
return nil
472+
return sys.processMeridian()
494473
}
495474

496475
func (sys *System) processScaling() error {

core/System_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ func TestSystem(t *testing.T) {
2424
func TestProjStringValidation(t *testing.T) {
2525
assert := assert.New(t)
2626

27-
ps, err := support.NewProjString("")
27+
_, err := support.NewProjString("")
2828
assert.NoError(err)
2929

30-
ps, err = support.NewProjString(" +proj=P99 +k1=a +k2=b \t ")
30+
ps, err := support.NewProjString(" +proj=P99 +k1=a +k2=b \t ")
3131
assert.NoError(err)
3232
assert.Equal(3, ps.Len())
3333

gie/Command.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ type testcase struct {
1919
inv bool
2020
accept coord
2121
expect coord
22-
trips int
2322
}
2423

2524
// Command holds a set of tests as we build them up

gie/Parser.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,10 @@ func NewParser(fname string) (*Parser, error) {
5151
continue
5252
}
5353

54-
if p.lines[0] != "" && (p.lines[0][0:1] >= "A" && p.lines[0][0:1] >= "Z") {
55-
//fmt.Printf("[%s:%d] JUNK: %s\n", p.fname, p.lineNum, p.lines[0])
56-
}
54+
//if p.lines[0] != "" && (p.lines[0][0:1] >= "A" && p.lines[0][0:1] >= "Z") {
55+
//fmt.Printf("[%s:%d] JUNK: %s\n", p.fname, p.lineNum, p.lines[0])
56+
//}
57+
5758
p.pop()
5859
}
5960

@@ -297,7 +298,7 @@ func readLines(fname string) ([]string, error) {
297298
if err != nil {
298299
return nil, err
299300
}
300-
defer file.Close()
301+
defer func() { _ = file.Close() }()
301302

302303
var lines []string
303304
scanner := bufio.NewScanner(file)

mlog/Log.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ func init() {
2828
func Debugf(format string, v ...interface{}) {
2929
if DebugEnabled {
3030
s := fmt.Sprintf(format, v...)
31-
debugLogger.Output(2, s)
31+
_ = debugLogger.Output(2, s)
3232
}
3333
}
3434

3535
// Printf writes a regular log message to stderr
3636
func Printf(format string, v ...interface{}) {
3737
if InfoEnabled {
3838
s := fmt.Sprintf(format, v...)
39-
infoLogger.Output(2, s)
39+
_ = infoLogger.Output(2, s)
4040
}
4141
}
4242

@@ -49,14 +49,14 @@ func Printv(v interface{}) {
4949
panic(err)
5050
}
5151
s := string(b)
52-
infoLogger.Output(2, s)
52+
_ = infoLogger.Output(2, s)
5353
}
5454
}
5555

5656
// Error writes an error message to stderr
5757
func Error(err error) {
5858
if ErrorEnabled {
5959
s := err.Error()
60-
errorLogger.Output(2, s)
60+
_ = errorLogger.Output(2, s)
6161
}
6262
}

operations/Airy.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ func (airy *Airy) Forward(lp *core.CoordLP) (*core.CoordXY, error) {
5050

5151
sinlam = math.Sin(lp.Lam)
5252
coslam = math.Cos(lp.Lam)
53+
5354
switch Q.mode {
55+
5456
case modeEquit, modeObliq:
5557
sinphi = math.Sin(lp.Phi)
5658
cosphi = math.Cos(lp.Phi)
@@ -74,7 +76,7 @@ func (airy *Airy) Forward(lp *core.CoordLP) (*core.CoordXY, error) {
7476
} else {
7577
xy.Y = Krho * sinphi
7678
}
77-
break
79+
7880
case modeSPole, modeNPole:
7981
lp.Phi = math.Abs(Q.phalfpi - lp.Phi)
8082
if !Q.nocut && (lp.Phi-eps10) > support.PiOverTwo {
@@ -94,6 +96,7 @@ func (airy *Airy) Forward(lp *core.CoordLP) (*core.CoordXY, error) {
9496
xy.Y = 0.
9597
}
9698
}
99+
97100
return xy, nil
98101
}
99102

operations/common.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ const (
1111

1212
const tol7 = 1.e-7
1313
const tol10 = 1.0e-10
14-
const tol14 = 1.0e-14
1514

1615
const eps7 = 1.0e-7
1716
const eps10 = 1.e-10

support/ProjString_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ func TestPairListGets(t *testing.T) {
6565
pl.Add(p3)
6666
pl.Add(p4)
6767

68-
vs, ok := pl.GetAsString("k99")
68+
_, ok := pl.GetAsString("k99")
6969
assert.False(ok)
7070

71-
vs, ok = pl.GetAsString("k2")
71+
vs, ok := pl.GetAsString("k2")
7272
assert.True(ok)
7373
assert.Equal("2.2", vs)
7474

@@ -95,13 +95,13 @@ func TestPairListGets(t *testing.T) {
9595
func TestPairListParsing(t *testing.T) {
9696
assert := assert.New(t)
9797

98-
pl, err := support.NewProjString("")
98+
_, err := support.NewProjString("")
9999
assert.NoError(err)
100100

101101
_, err = support.NewProjString("k1=v1=v2")
102102
assert.Error(err)
103103

104-
pl, err = support.NewProjString(" +proj=v1 +k2=v2 k3=v3 \t\t k4= k5")
104+
pl, err := support.NewProjString(" +proj=v1 +k2=v2 k3=v3 \t\t k4= k5")
105105
assert.NoError(err)
106106
assert.Equal(4, pl.Len())
107107

0 commit comments

Comments
 (0)