mirror of https://github.com/k3s-io/k3s
Merge pull request #68983 from dims/fix-man-pages-to-build-reproducibly
Fix for man pages do not build reproduciblypull/58/head
commit
0064c6f542
|
@ -19,6 +19,7 @@ package genericclioptions
|
|||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
@ -49,6 +50,7 @@ func (f *JSONPathPrintFlags) AllowedFormats() []string {
|
|||
for format := range jsonFormats {
|
||||
formats = append(formats, format)
|
||||
}
|
||||
sort.Strings(formats)
|
||||
return formats
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import (
|
|||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
|
@ -101,6 +102,9 @@ func TestPrinterSupportsExpectedJSONPathFormats(t *testing.T) {
|
|||
printFlags := JSONPathPrintFlags{
|
||||
TemplateArgument: templateArg,
|
||||
}
|
||||
if !sort.StringsAreSorted(printFlags.AllowedFormats()) {
|
||||
t.Fatalf("allowed formats are not sorted")
|
||||
}
|
||||
|
||||
p, err := printFlags.ToPrinter(tc.outputFormat)
|
||||
if tc.expectNoMatch {
|
||||
|
@ -180,6 +184,9 @@ func TestJSONPathPrinterDefaultsAllowMissingKeysToTrue(t *testing.T) {
|
|||
TemplateArgument: &tc.templateArg,
|
||||
AllowMissingKeys: tc.allowMissingKeys,
|
||||
}
|
||||
if !sort.StringsAreSorted(printFlags.AllowedFormats()) {
|
||||
t.Fatalf("allowed formats are not sorted")
|
||||
}
|
||||
|
||||
outputFormat := "jsonpath"
|
||||
p, err := printFlags.ToPrinter(outputFormat)
|
||||
|
|
|
@ -19,6 +19,7 @@ package genericclioptions
|
|||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
@ -51,6 +52,7 @@ func (f *GoTemplatePrintFlags) AllowedFormats() []string {
|
|||
for format := range templateFormats {
|
||||
formats = append(formats, format)
|
||||
}
|
||||
sort.Strings(formats)
|
||||
return formats
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import (
|
|||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
|
@ -101,6 +102,9 @@ func TestPrinterSupportsExpectedTemplateFormats(t *testing.T) {
|
|||
printFlags := GoTemplatePrintFlags{
|
||||
TemplateArgument: templateArg,
|
||||
}
|
||||
if !sort.StringsAreSorted(printFlags.AllowedFormats()) {
|
||||
t.Fatalf("allowed formats are not sorted")
|
||||
}
|
||||
|
||||
p, err := printFlags.ToPrinter(tc.outputFormat)
|
||||
if tc.expectNoMatch {
|
||||
|
@ -174,6 +178,9 @@ func TestTemplatePrinterDefaultsAllowMissingKeysToTrue(t *testing.T) {
|
|||
TemplateArgument: &tc.templateArg,
|
||||
AllowMissingKeys: tc.allowMissingKeys,
|
||||
}
|
||||
if !sort.StringsAreSorted(printFlags.AllowedFormats()) {
|
||||
t.Fatalf("allowed formats are not sorted")
|
||||
}
|
||||
|
||||
outputFormat := "template"
|
||||
p, err := printFlags.ToPrinter(outputFormat)
|
||||
|
|
Loading…
Reference in New Issue