main.go 598 B

1234567891011121314151617181920212223242526272829303132333435
  1. //go:generate make deps
  2. package main
  3. import (
  4. "devel.mephi.ru/dyokunev/go-sdapi/sdApi1"
  5. "fmt"
  6. "github.com/alyu/configparser"
  7. )
  8. func checkErr(err error) {
  9. if err != nil {
  10. panic(err)
  11. }
  12. }
  13. func main() {
  14. config, err := configparser.Read("/etc/sdapi.ini")
  15. checkErr(err)
  16. section, err := config.Section("sdapi1")
  17. checkErr(err)
  18. sdApi1.SetApiKey(section.ValueOf("api_key"))
  19. units, err := sdApi1.GetUnits()
  20. checkErr(err)
  21. unitsMap := units.ToMap()
  22. unit536 := unitsMap[8000161]
  23. unit536recursive := unit536.GetRecursive()
  24. fmt.Printf("unitIds == %v\n", unit536recursive.GetUnitIds())
  25. }