go-satellite
go-satellite copied to clipboard
suspicious unused argument
I'm working of cleaning the code with some linters and found this
dspace.go:18:371: SA4009: argument dedt is overwritten before first use (staticcheck)
func dsinit(whichconst GravConst, cosim, emsq, argpo, s1, s2, s3, s4, s5, sinim, ss1, ss2, ss3, ss4, ss5, sz1, sz3, sz11, sz13, sz21, sz23, sz31, sz33, t, tc, gsto, mo, mdot, no, nodeo, nodedot, xpidot, z1, z3, z11, z13, z21, z23, z31, z33, ecco, eccsq, em, argpm, inclm, mm, nm, nodem, irez, atime, d2201, d2211, d3210, d3222, d4410, d4422, d5220, d5232, d5421, d5433, dedt, didt, dmdt, dnodt, domdt, del1, del2, del3, xfact, xlamo, xli, xni float64) (res DeepSpaceInitResult) {
^
dspace.go:462:52: SA4009: argument e3 is overwritten before first use (staticcheck)
func dscom(epoch, ep, argpp, tc, inclp, nodep, np, e3, ee2, peo, pgho, pho, pinco, plo, se2, se3, sgh2, sgh3, sgh4, sh2, sh3, si2, si3, sl2, sl3, sl4, xgh2, xgh3, xgh4, xh2, xh3, xi2, xi3, xl2, xl3, xl4, zmol, zmos float64) (res DSComResults) {
For example e3 = 2.0 * s1 * s7
is assigned before read
These two in particular are meant to be outputs of these methods according to the original function headers - should've included those when I ported the library...
I've done a brief look-over, and it's kinda silly to pass these into the function when they're meant to be outputs. It'd be ideal to go through the headers of the original implementation and make changes to the function declarations here to align them. I believe these were essentially passed-by-reference variables in the original implementation.
Linking my other comment here as well; this indicates the root-cause of these issues: https://github.com/joshuaferrara/go-satellite/pull/7#issuecomment-596023334