go-ini.go 1019 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. package main
  2. import (
  3. "fmt"
  4. "git.giaever.org/joachimmg/go-ini.git/ini"
  5. )
  6. type Test struct {
  7. String string
  8. UnquotedString string
  9. MultipleLines string
  10. WithoutValue bool
  11. Int struct {
  12. Int int
  13. Int8 int8
  14. Int16 int16
  15. Int32 int32
  16. Int64 int64
  17. Uint struct {
  18. Uint uint
  19. Uint8 uint8
  20. Unint16 uint16
  21. Uint32 uint32
  22. Uint64 uint64
  23. }
  24. }
  25. }
  26. func main() {
  27. text := `
  28. String = "This is some text"
  29. UnquotedString = This is some unquoted text
  30. MultipleLines = This is \
  31. multiple lines \
  32. going on
  33. WithoutValue
  34. [int]
  35. Int = -1
  36. Int8 = -8
  37. Int16 = -16
  38. Int32 = -32
  39. Int64 = -64
  40. [int.uint]
  41. Uint = 1
  42. Uint8 = 8
  43. Uint16 = 16
  44. Uint32 = 32
  45. Uint64 = 64
  46. Uint64 = 64
  47. `
  48. fmt.Println("INI", text)
  49. test1 := Test{}
  50. test2 := Test{
  51. String: "This is some text",
  52. UnquotedString: "Helloooo... Not possible to not quote this",
  53. MultipleLines: "This is \nmultiple lines \ngoing on",
  54. WithoutValue: true,
  55. }
  56. //test2 := &Test{}
  57. ini.Unmarshal([]byte(text), test1)
  58. ini.Marshal(test2)
  59. }