...

Text file src/cmd/gofmt/testdata/rewrite5.golden

Documentation: cmd/gofmt/testdata

     1//gofmt -r=x+x->2*x
     2
     3// Copyright 2011 The Go Authors. All rights reserved.
     4// Use of this source code is governed by a BSD-style
     5// license that can be found in the LICENSE file.
     6
     7// Rewriting of expressions containing nodes with associated comments to
     8// expressions without those nodes must also eliminate the associated
     9// comments.
    10
    11package p
    12
    13func f(x int) int {
    14	_ = 2 * x // this comment remains in the rewrite
    15	_ = 2 * x
    16	return 2 * x
    17}

View as plain text