MCPcopy Index your code
hub / github.com/devspace-sh/devspace / String

Method String

pkg/util/constraint/version.go:367–384  ·  view source on GitHub ↗

String returns the full version string included pre-release and metadata information. This value is rebuilt according to the parsed segments and other information. Therefore, ambiguities in the version string such as prefixed zeroes (1.04.0 => 1.4.0), `v` prefix (v1.0.0 => 1.0.0), and missing parts

()

Source from the content-addressed store, hash-verified

365// missing parts (1.0 => 1.0.0) will be made into a canonicalized form
366// as shown in the parenthesized examples.
367func (v *Version) String() string {
368 var buf bytes.Buffer
369 fmtParts := make([]string, len(v.segments))
370 for i, s := range v.segments {
371 // We can ignore err here since we've pre-parsed the values in segments
372 str := strconv.FormatInt(s, 10)
373 fmtParts[i] = str
374 }
375 _, _ = fmt.Fprintf(&buf, "%s", strings.Join(fmtParts, "."))
376 if v.pre != "" {
377 _, _ = fmt.Fprintf(&buf, "-%s", v.pre)
378 }
379 if v.metadata != "" {
380 _, _ = fmt.Fprintf(&buf, "+%s", v.metadata)
381 }
382
383 return buf.String()
384}
385
386// Original returns the original parsed version as-is, including any
387// potential whitespace, `v` prefix, etc.

Callers 8

TestVersionStringFunction · 0.95
CompareMethod · 0.95
GetHashFunction · 0.45
DirectoryExcludesFunction · 0.45
RunMethod · 0.45
RunAlwaysMethod · 0.45
StartMethod · 0.45
QuestionMethod · 0.45

Calls 1

StringMethod · 0.95

Tested by 1

TestVersionStringFunction · 0.76