Skip to content

Upgrading from v1.x to v2.0.0

Markus edited this page May 8, 2020 · 4 revisions
  1. go get -u github.com/markus-wa/demoinfocs-golang/v2/pkg/demoinfocs

  2. replace all imports of github.com/markus-wa/demoinfocs-golang{/...} with github.com/markus-wa/demoinfocs-golang/v2/pkg/demoinfocs{/...}

    github.com/markus-wa/demoinfocs-golang -> github.com/markus-wa/demoinfocs-golang/v2/pkg/demoinfocs

    github.com/markus-wa/demoinfocs-golang/common -> github.com/markus-wa/demoinfocs-golang/v2/pkg/demoinfocs/common

    ...

  3. delete github.com/markus-wa/demoinfocs-golang v1.x.x from go.mod

  4. run go build to find compilation errors

  5. fix according to change log / common errors are below

  6. profit 🎉

Common Errors

./csminify.go:86:28: cannot use p (type demoinfocs.Parser) as type *demoinfocs.Parser in assignment:
	*demoinfocs.Parser is pointer to interface, not interface

change *demoinfocs.Parser -> demoinfocs.Parser


./events.go:104:46: e.Weapon.Weapon undefined (type *common.Equipment has no field or method Weapon)

change e.Weapon.Weapon -> e.Weapon.Type


./csminify.go:158:5: cannot use player.Armor (type func() int) as type int in field value

change player.Armor -> player.Armor()


./csminify.go:158:22: player.Hp undefined (type *common.Player has no field or method Hp)

change player.Hp -> player.Health()

Clone this wiki locally