MCPcopy Create free account
hub / github.com/Masterminds/semver / String

Method String

version.go:340–352  ·  view source on GitHub ↗

String converts a Version object to a string. Note, if the original version contained a leading v this version will not. See the Original() method to retrieve the original value. Semantic Versions don't contain a leading v per the spec. Instead it's optional on implementation.

()

Source from the content-addressed store, hash-verified

338// don't contain a leading v per the spec. Instead it's optional on
339// implementation.
340func (v Version) String() string {
341 var buf bytes.Buffer
342
343 fmt.Fprintf(&buf, "%d.%d.%d", v.major, v.minor, v.patch)
344 if v.pre != "" {
345 fmt.Fprintf(&buf, "-%s", v.pre)
346 }
347 if v.metadata != "" {
348 fmt.Fprintf(&buf, "+%s", v.metadata)
349 }
350
351 return buf.String()
352}
353
354// Original returns the original value passed in to be parsed.
355func (v *Version) Original() string {

Callers 15

TestCoerceStringFunction · 0.95
TestIncFunction · 0.95
TestJsonUnmarshalFunction · 0.95
TestTextUnmarshalFunction · 0.95
TestSQLScannerFunction · 0.95
TestScanInputTypesFunction · 0.95
TestCollectionFunction · 0.95
NewFunction · 0.95
MarshalJSONMethod · 0.95
MarshalTextMethod · 0.95
ValueMethod · 0.95
TestNewFunction · 0.45

Calls

no outgoing calls

Tested by 13

TestCoerceStringFunction · 0.76
TestIncFunction · 0.76
TestJsonUnmarshalFunction · 0.76
TestTextUnmarshalFunction · 0.76
TestSQLScannerFunction · 0.76
TestScanInputTypesFunction · 0.76
TestCollectionFunction · 0.76
TestNewFunction · 0.36
TestSetPrereleaseFunction · 0.36
TestSetMetadataFunction · 0.36
TestParseConstraintFunction · 0.36
TestConstraintStringFunction · 0.36