From 541612b9746c1c314884af4079bfe8d340aaf953 Mon Sep 17 00:00:00 2001 From: Rob Findley Date: Mon, 21 Jun 2021 20:12:20 -0400 Subject: [PATCH] [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 Run-TryBot: Robert Findley TryBot-Result: Go Bot Reviewed-by: Robert Griesemer --- src/cmd/gofmt/doc.go | 3 --- src/cmd/gofmt/gofmt_test.go | 7 ------- src/cmd/gofmt/gofmt_typeparams_test.go | 12 ------------ src/cmd/gofmt/testdata/typeparams.golden | 2 +- src/cmd/gofmt/testdata/typeparams.input | 2 +- 5 files changed, 2 insertions(+), 24 deletions(-) delete mode 100644 src/cmd/gofmt/gofmt_typeparams_test.go diff --git a/src/cmd/gofmt/doc.go b/src/cmd/gofmt/doc.go index 68476e7d44..e340665594 100644 --- a/src/cmd/gofmt/doc.go +++ b/src/cmd/gofmt/doc.go @@ -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 diff --git a/src/cmd/gofmt/gofmt_test.go b/src/cmd/gofmt/gofmt_test.go index f0d3f8780f..9ef7676214 100644 --- a/src/cmd/gofmt/gofmt_test.go +++ b/src/cmd/gofmt/gofmt_test.go @@ -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) } diff --git a/src/cmd/gofmt/gofmt_typeparams_test.go b/src/cmd/gofmt/gofmt_typeparams_test.go deleted file mode 100644 index 10641a77cb..0000000000 --- a/src/cmd/gofmt/gofmt_typeparams_test.go +++ /dev/null @@ -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 -} diff --git a/src/cmd/gofmt/testdata/typeparams.golden b/src/cmd/gofmt/testdata/typeparams.golden index 35f08d1379..f71bd130db 100644 --- a/src/cmd/gofmt/testdata/typeparams.golden +++ b/src/cmd/gofmt/testdata/typeparams.golden @@ -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 diff --git a/src/cmd/gofmt/testdata/typeparams.input b/src/cmd/gofmt/testdata/typeparams.input index 7f3212c8e4..5d4c53d9f7 100644 --- a/src/cmd/gofmt/testdata/typeparams.input +++ b/src/cmd/gofmt/testdata/typeparams.input @@ -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