Skip to content

cmd/go2go: gofmt doesn't work #41079

@YoshikiShibata

Description

@YoshikiShibata

go2 version:

$ git rev-parse HEAD
af1adc5d8ce8125ae953359402989eb8c14988c5

Thanks for fixing gofmt, but another problem.

I declare Builder as following:

// Builder is a mutable builder for a Stream. This allows the creation of a
// Stream by generating elements individually and adding them to the Builder.
type Builder[type T any] struct {
}

// Add adds an element to the stream being built.
func (b *Builder[T]) Add(t T) {
    panic("Not Implemented Yet")
}

With this declaration, I can compile and run the following code:

func TestBuilder(t *testing.T) {
    var builder Builder[int]

    for i := 0; i < 100; i++ {
        builder.Add(i)
    }
}

However, after gofmt which deletes type from the Builder declaration as following:

type Builder[T any] struct {
}

Then the testing code above will not be compiled:

builder_test.go2:6:21: expected ';', found '['

Line 6 is var builder Builder[int] in the above testing code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions