Skip to content

Refactor simple-game-server #3813

@markmandel

Description

@markmandel

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 giant switch 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?

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` directorykind/cleanupRefactoring code, fixing up documentation, etc

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions