Skip to content

Commit 30b1522

Browse files
committed
Fix inspection issues
1 parent bdc03d0 commit 30b1522

File tree

16 files changed

+67
-84
lines changed

16 files changed

+67
-84
lines changed

cmd/ssl-auto-ref-client/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ func (c *Client) sendRequest(request *rcon.AutoRefToController, doLog bool) {
210210
}
211211

212212
logIf(doLog, "Waiting for reply...")
213-
reply := rcon.ControllerToAutoRef{}
214-
if err := sslconn.ReceiveMessage(c.reader, &reply); err != nil {
213+
reply := &rcon.ControllerToAutoRef{}
214+
if err := sslconn.ReceiveMessage(c.reader, reply); err != nil {
215215
log.Fatal("Failed receiving controller reply: ", err)
216216
}
217217
logIf(doLog, "Received reply: ", reply)

cmd/ssl-ref-client/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@ import (
1717

1818
var refereeAddress = flag.String("address", "224.5.23.1:10003", "The multicast address of ssl-game-controller")
1919
var fullScreen = flag.Bool("fullScreen", false, "Print the formatted message to the console, clearing the screen during print")
20+
var verbose = flag.Bool("verbose", false, "Verbose output")
2021

2122
var history []state.Referee_Command
2223

2324
func main() {
2425
flag.Parse()
2526

2627
server := sslnet.NewMulticastServer(consume)
28+
server.Verbose = *verbose
2729
server.Start(*refereeAddress)
2830

2931
signals := make(chan os.Signal, 1)

internal/app/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ func DefaultControllerConfig() (c Controller) {
254254
return
255255
}
256256

257-
// loadConfig loads the controller config
257+
// LoadConfig loads the controller config
258258
func LoadConfig(configFileName string) Controller {
259259
cfg, err := LoadControllerConfig(configFileName)
260260
if err != nil {

internal/app/config/division.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const (
77
DivB Division = "DIV_B"
88
)
99

10-
// Division contain all known command enum constants
10+
// Divisions contain all known command enum constants
1111
var Divisions = []Division{DivA, DivB}
1212

1313
// Valid checks if the Division enum value is among the known values

internal/app/engine/proposals.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func (e *Engine) EnqueueGameEvent(gameEvent *state.GameEvent) {
2626

2727
switch autoRefBehavior {
2828
case AutoRefConfig_BEHAVIOR_IGNORE:
29-
log.Printf("Ignoring game event from autoRef: %v", *gameEvent)
29+
log.Printf("Ignoring game event from autoRef: %v", gameEvent)
3030
case AutoRefConfig_BEHAVIOR_LOG:
3131
e.Enqueue(&statemachine.Change{
3232
Origin: &changeOriginEngine,

internal/app/geom/geometry.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,46 +16,46 @@ func NewVector2Float32(x, y float32) *Vector2 {
1616
}
1717

1818
// Length returns the length of this vector
19-
func (m *Vector2) Length() float64 {
20-
x := *m.X
21-
y := *m.Y
22-
return math.Sqrt(float64(x*x + y*y))
19+
func (x *Vector2) Length() float64 {
20+
vx := *x.X
21+
vy := *x.Y
22+
return math.Sqrt(float64(vx*vx + vy*vy))
2323
}
2424

2525
// Sub subtracts the given vector from this one
26-
func (m *Vector2) Sub(o *Vector2) *Vector2 {
27-
return NewVector2Float32(*m.X-*o.X, *m.Y-*o.Y)
26+
func (x *Vector2) Sub(o *Vector2) *Vector2 {
27+
return NewVector2Float32(*x.X-*o.X, *x.Y-*o.Y)
2828
}
2929

3030
// DistanceTo returns the distance between this vector and the given one
31-
func (m *Vector2) DistanceTo(o *Vector2) float64 {
32-
return m.Sub(o).Length()
31+
func (x *Vector2) DistanceTo(o *Vector2) float64 {
32+
return x.Sub(o).Length()
3333
}
3434

3535
// X64 returns the x value as float64
36-
func (m *Vector2) X64() float64 {
37-
return float64(*m.X)
36+
func (x *Vector2) X64() float64 {
37+
return float64(*x.X)
3838
}
3939

4040
// Y64 returns the y value as float64
41-
func (m *Vector2) Y64() float64 {
42-
return float64(*m.Y)
41+
func (x *Vector2) Y64() float64 {
42+
return float64(*x.Y)
4343
}
4444

4545
// ToVector2 converts this vector into a new 2d vector, dropping the z part
46-
func (m *Vector3) ToVector2() *Vector2 {
47-
return NewVector2Float32(*m.X, *m.Y)
46+
func (x *Vector3) ToVector2() *Vector2 {
47+
return NewVector2Float32(*x.X, *x.Y)
4848
}
4949

5050
// StringPretty converts the vector into a pretty printed string
51-
func (m *Vector2) StringPretty() string {
52-
x := float32(0)
53-
y := float32(0)
54-
if m.X != nil {
55-
x = *m.X
51+
func (x *Vector2) StringPretty() string {
52+
vx := float32(0)
53+
vy := float32(0)
54+
if x.X != nil {
55+
vx = *x.X
5656
}
57-
if m.Y != nil {
58-
y = *m.Y
57+
if x.Y != nil {
58+
vy = *x.Y
5959
}
60-
return fmt.Sprintf("x: %v, y: %v", x, y)
60+
return fmt.Sprintf("x: %v, y: %v", vx, vy)
6161
}

internal/app/geom/rectangle.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,17 @@ func (r *Rectangle) MaxX() float64 {
4343
return r.center.X64() + r.xExtent/2.0
4444
}
4545

46-
// MaxX returns the smallest x value
46+
// MinX returns the smallest x value
4747
func (r *Rectangle) MinX() float64 {
4848
return r.center.X64() - r.xExtent/2.0
4949
}
5050

51-
// MaxX returns the largest y value
51+
// MaxY returns the largest y value
5252
func (r *Rectangle) MaxY() float64 {
5353
return r.center.Y64() + r.yExtent/2.0
5454
}
5555

56-
// MaxX returns the smallest y value
56+
// MinY returns the smallest y value
5757
func (r *Rectangle) MinY() float64 {
5858
return r.center.Y64() - r.yExtent/2.0
5959
}

internal/app/state/command.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ func NewCommandNeutral(t Command_Type) (c *Command) {
1313
}
1414

1515
// NeedsTeam returns true if the command must be specialized with a team
16-
func (m Command) NeedsTeam() bool {
17-
switch *m.Type {
16+
func (x *Command) NeedsTeam() bool {
17+
switch *x.Type {
1818
case Command_UNKNOWN,
1919
Command_HALT,
2020
Command_STOP,
@@ -29,14 +29,14 @@ func (m Command) NeedsTeam() bool {
2929
Command_BALL_PLACEMENT:
3030
return true
3131
default:
32-
log.Fatal("Missing case for command ", m)
32+
log.Fatal("Missing case for command ", x)
3333
return false
3434
}
3535
}
3636

3737
// IsRunning returns true, if the current commands indicates that the game is running (the ball is in play)
38-
func (m Command) IsRunning() bool {
39-
switch *m.Type {
38+
func (x *Command) IsRunning() bool {
39+
switch *x.Type {
4040
case Command_DIRECT,
4141
Command_INDIRECT,
4242
Command_NORMAL_START,
@@ -47,8 +47,8 @@ func (m Command) IsRunning() bool {
4747
}
4848

4949
// IsPrepare returns true, if the current command is a prepare command
50-
func (m Command) IsPrepare() bool {
51-
switch *m.Type {
50+
func (x *Command) IsPrepare() bool {
51+
switch *x.Type {
5252
case Command_PENALTY,
5353
Command_KICKOFF:
5454
return true

internal/app/state/gameevent.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import (
55
)
66

77
// ByTeam extracts the `ByTeam` attribute from the game event details, if present
8-
func (m GameEvent) ByTeam() Team {
9-
if m.GetEvent() == nil {
8+
func (x *GameEvent) ByTeam() Team {
9+
if x.GetEvent() == nil {
1010
return Team_UNKNOWN
1111
}
12-
event := reflect.ValueOf(m.GetEvent())
12+
event := reflect.ValueOf(x.GetEvent())
1313
if event.Elem().NumField() == 0 {
1414
return Team_UNKNOWN
1515
}
@@ -25,11 +25,11 @@ func (m GameEvent) ByTeam() Team {
2525
}
2626

2727
// SetByTeam sets the value of the `ByTeam` attribute to the given value, if present and not nil
28-
func (m GameEvent) SetByTeam(team Team) {
29-
if m.GetEvent() == nil {
28+
func (x *GameEvent) SetByTeam(team Team) {
29+
if x.GetEvent() == nil {
3030
return
3131
}
32-
event := reflect.ValueOf(m.GetEvent())
32+
event := reflect.ValueOf(x.GetEvent())
3333
if event.Elem().NumField() == 0 {
3434
return
3535
}

internal/app/state/gameevent_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ func TestGameEvent_ByTeam(t *testing.T) {
3636
},
3737
{
3838
name: "Event without ByTeam",
39-
event: &GameEvent_Prepared_{
40-
Prepared: &GameEvent_Prepared{},
39+
event: &GameEvent_NoProgressInGame_{
40+
NoProgressInGame: &GameEvent_NoProgressInGame{},
4141
},
4242
want: Team_UNKNOWN,
4343
},
@@ -86,8 +86,8 @@ func TestGameEvent_SetByTeam(t *testing.T) {
8686
},
8787
{
8888
name: "Event without ByTeam",
89-
event: &GameEvent_Prepared_{
90-
Prepared: &GameEvent_Prepared{},
89+
event: &GameEvent_NoProgressInGame_{
90+
NoProgressInGame: &GameEvent_NoProgressInGame{},
9191
},
9292
want: Team_UNKNOWN,
9393
},

0 commit comments

Comments
 (0)