From 34594c771f2c18301dc152640ad40ece28795373 Mon Sep 17 00:00:00 2001 From: Anthony Fok Date: Mon, 24 Jul 2017 13:36:59 -0600 Subject: [PATCH] Fix TestGlobalNormFuncPropagation() on gccgo According to golang/go#9504 and https://golang.org/pkg/reflect/#Value, == should not be used on two reflect.Values, but comparing the results of their Interface() method does not work in this case, so let's compare the results of their Pointer() method instead. See https://stackoverflow.com/questions/9643205/how-do-i-compare-two-functions-for-pointer-equality-in-the-latest-go-weekly --- cobra_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cobra_test.go b/cobra_test.go index 1706eae2..d5df951e 100644 --- a/cobra_test.go +++ b/cobra_test.go @@ -1166,7 +1166,7 @@ func TestGlobalNormFuncPropagation(t *testing.T) { rootCmd := initialize() rootCmd.SetGlobalNormalizationFunc(normFunc) - if reflect.ValueOf(normFunc) != reflect.ValueOf(rootCmd.GlobalNormalizationFunc()) { + if reflect.ValueOf(normFunc).Pointer() != reflect.ValueOf(rootCmd.GlobalNormalizationFunc()).Pointer() { t.Error("rootCmd seems to have a wrong normalization function") }