Skip to content

Serialization for arrays of rune not a possibility? #335

Closed as not planned
Closed as not planned

Description

@lindrax

Version

1.19 (ini - v1.67.0)

Describe the bug

For every save of an ini file, the fields that are an array of rune is set to empty.

To reproduce

type Example struct {
  Prop1 []rune `ini:"prop.1"`
}

func Gen(path string) {
  def := Example{ Prop1: []rune("abc") }
  file := ini.Empty()
  ini.ReflectFrom(file, &def)
  file.SaveTo(path) // current result -> prop.1 = 
}

Expected behavior

Expected result would be to split every character with a symbol of sorts and then set it as the value.

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added
    bug
    on Feb 6, 2023
  2. unknwon commented on Nov 11, 2026

    @unknwon
    Member

    []rune is []int32 to reflection, so it can't be told apart from a list of numbers, and it isn't supported. v2 (unknwon.dev/ini/v2) returns an error for it, unsupported type '[]int32', instead of writing an empty value. Use a string field for text, or a type that implements MarshalINI and UnmarshalINI in v2 for your own format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions