-
Notifications
You must be signed in to change notification settings - Fork 858
Closed
Labels
area/examplesExamples. Usually found in the `examples` directoryExamples. Usually found in the `examples` directorykind/cleanupRefactoring code, fixing up documentation, etcRefactoring code, fixing up documentation, etc
Description
https://github.com/googleforgames/agones/blob/main/examples/simple-game-server/main.go is getting really large, and a little unweildy!
Let's take some time to refactor it it into something that's a bit more manageable.
Some suggestions include:
- Use a
map
of commands rather than a giantswitch
statement - Split into multiple files (where it makes sense)
- A lot of the SDK calls, such as
setAnnotation(...)
have very similar function wrappers - can we generalise this in some way?
agones/examples/simple-game-server/main.go
Lines 605 to 611 in d85a5ae
func setAnnotation(s *sdk.SDK, key, value string) { | |
log.Printf("Setting annotation %v=%v", key, value) | |
err := s.SetAnnotation(key, value) | |
if err != nil { | |
log.Fatalf("could not set annotation: %v", err) | |
} | |
} |
...and anything else that jumps out!
Metadata
Metadata
Assignees
Labels
area/examplesExamples. Usually found in the `examples` directoryExamples. Usually found in the `examples` directorykind/cleanupRefactoring code, fixing up documentation, etcRefactoring code, fixing up documentation, etc