[dev.typeparams] cmd/gofmt: remove typeparams guards

Remove logic related to guarding against allowing type parameters from
cmd/gofmt. At this point, it was only restricting tests.

Change-Id: Idd198389aaa422636d61af547a37be49f3be6c97
Reviewed-on: https://go-review.googlesource.com/c/go/+/329931
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
Rob Findley 2021-06-21 20:12:20 -04:00 committed by Robert Findley
parent 3e6219c6a9
commit 541612b974
5 changed files with 2 additions and 24 deletions

View file

@ -26,9 +26,6 @@ The flags are:
Do not print reformatted sources to standard output.
If a file's formatting is different from gofmt's, print its name
to standard output.
-G
Allow generic code, using type parameters.
See golang.org/issues/43651 for more information.
-r rule
Apply the rewrite rule to the source before reformatting.
-s

View file

@ -54,8 +54,6 @@ func gofmtFlags(filename string, maxLines int) string {
return ""
}
var typeParamsEnabled = false
func runTest(t *testing.T, in, out string) {
// process flags
*simplifyAST = false
@ -78,11 +76,6 @@ func runTest(t *testing.T, in, out string) {
case "-stdin":
// fake flag - pretend input is from stdin
stdin = true
case "-G":
// fake flag - test is for generic code
if !typeParamsEnabled {
return
}
default:
t.Errorf("unrecognized flag name: %s", name)
}

View file

@ -1,12 +0,0 @@
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build typeparams
// +build typeparams
package main
func init() {
typeParamsEnabled = true
}

View file

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//gofmt -G
//gofmt
package typeparams

View file

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//gofmt -G
//gofmt
package typeparams