Masterminds / semver

Work with Semantic Versions in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The semver.version Marshal Problem

babashankar opened this issue · comments

If I define a field inside a json structure of semver.Version type when I marshal this json structure using json.Marshal it's not generating the version string for the json field.

type Example struct{
Version semver.Version json:"version"
}
If I marshal this structure the expected output is {"verison":"1.9.0"} but the actual output I am getting is {"version":{}}.

should the semver.Version type shoud implement MarshalText() and UnmarshalText() of interface TextMarshaler, to achieve the above?