Skip to content

Incorrect package name in pkg/tcpip/stack/bridge_test.go #11531

Open
@wilinz

Description

@wilinz

Description

In the file pkg/tcpip/stack/bridge_test.go, the package name is incorrectly set to bridge_test, which causes a compilation error due to conflicting package names in the same directory (stack and bridge). According to Go conventions, all files in the same directory should belong to the same package unless explicitly using external test packages (*_test packages), which does not appear to be the case here.

Steps to Reproduce

  1. Create a new Go application:

    mkdir gvisor-test-app
    cd gvisor-test-app
    go mod init gvisor-test-app
  2. Execute go get to install the specified version of gVisor:

    go get gvisor.dev/[email protected]
  3. Create a simple program that uses the gvisor.dev/gvisor/pkg/tcpip/stack package. Create a main.go file with the following content:

    package main
    
    import (
        "fmt"
        "gvisor.dev/gvisor/pkg/tcpip/stack"
    )
    
    func main() {
        // Create a simple TCP/IP stack instance
        s := stack.New(stack.Options{})
    
        // Print the stack instance
        fmt.Println("Created a new stack instance:", s)
    }
  4. Run the program with go run main.go. You should see a compilation error due to the conflicting package names in pkg/tcpip/stack/bridge_test.go.

Expected Behavior

The package name in bridge_test.go should be consistent with other files in the directory and likely renamed to stack_test to resolve the conflict and follow Go conventions.

Environment

  • gVisor version: v0.0.0-20250307022211-9581066c3038
  • Go version: 1.23.7
  • OS: Windows 11, amd64

Additional Context

This issue might have been introduced unintentionally and can be resolved by renaming the package in bridge_test.go to stack_test.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions