goss-org / goss

Quick and Easy server testing/validation
https://goss.rocks
Apache License 2.0
5.57k stars 472 forks source link

Add port command fails #678

Closed bekihm closed 3 years ago

bekihm commented 3 years ago

Describe the bug

If I execute goss a port 80 a slice bounds out of range runtime error is thrown. Other command like goss a package test works like expected.

How To Reproduce

goss a port 80

Expected Behavior

goss should create a gossfile with the port specification on port 80.

Actual Behavior

panic: runtime error: slice bounds out of range [1:0]

goroutine 1 [running]:
github.com/aelsabbahy/GOnetstat.getData(0xa796f5, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/travis/gopath/pkg/mod/github.com/aelsabbahy/!g!onetstat@v0.0.0-20160428114218-edf89f784e08/gonetstat.go:83 +0x28e
github.com/aelsabbahy/GOnetstat.netstat(0xa796f5, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/travis/gopath/pkg/mod/github.com/aelsabbahy/!g!onetstat@v0.0.0-20160428114218-edf89f784e08/gonetstat.go:220 +0x50
github.com/aelsabbahy/GOnetstat.Tcp(...)
        /home/travis/gopath/pkg/mod/github.com/aelsabbahy/!g!onetstat@v0.0.0-20160428114218-edf89f784e08/gonetstat.go:272
github.com/aelsabbahy/goss/system.GetPorts(0x42c800, 0x6)
        /home/travis/gopath/src/github.com/aelsabbahy/goss/system/port.go:69 +0x69
github.com/aelsabbahy/goss/system.(*System).Ports.func1()
        /home/travis/gopath/src/github.com/aelsabbahy/goss/system/system.go:46 +0x2f
sync.(*Once).doSlow(0xc0000d66b0, 0xc0001556e8)
        /home/travis/.gimme/versions/go1.13.15.linux.amd64/src/sync/once.go:66 +0xe3
sync.(*Once).Do(...)
        /home/travis/.gimme/versions/go1.13.15.linux.amd64/src/sync/once.go:57
github.com/aelsabbahy/goss/system.(*System).Ports(0xc0000d6630, 0xa796f5)
        /home/travis/gopath/src/github.com/aelsabbahy/goss/system/system.go:45 +0x74
github.com/aelsabbahy/goss/system.NewDefPort(0x7fffdee55bab, 0x2, 0xc0000d6630, 0x100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/travis/gopath/src/github.com/aelsabbahy/goss/system/port.go:27 +0xa8
github.com/aelsabbahy/goss/resource.PortMap.AppendSysResource(0xc000140c60, 0x7fffdee55bab, 0x2, 0xc0000d6630, 0x100, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/travis/gopath/src/github.com/aelsabbahy/goss/resource/resource_list.go:737 +0x81
github.com/aelsabbahy/goss.AddResource(0xa800ae, 0xb, 0xc000140bd0, 0xc000140c00, 0xc000140c30, 0xc000140c60, 0xc000140c90, 0xc000140cc0, 0xc000140cf0, 0xc000140d20, ...)
        /home/travis/gopath/src/github.com/aelsabbahy/goss/add.go:63 +0x530
github.com/aelsabbahy/goss.AddResources(0xa800ae, 0xb, 0xa79ae5, 0x4, 0xc00001e0f0, 0x1, 0x1, 0xc000001380, 0x5, 0x4)
        /home/travis/gopath/src/github.com/aelsabbahy/goss/add.go:35 +0x430
main.main.func8(0xc0000217c0, 0xc00002ea00, 0xc000021700)
        /home/travis/gopath/src/github.com/aelsabbahy/goss/cmd/goss/goss.go:273 +0xe3
github.com/urfave/cli.HandleAction(0x9b2d60, 0xaa9258, 0xc0000217c0, 0xc00002ea00, 0x0)
        /home/travis/gopath/pkg/mod/github.com/urfave/cli@v0.0.0-20161102131801-d86a009f5e13/app.go:471 +0xad
github.com/urfave/cli.Command.Run(0xa79f8d, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0xa99329, 0x35, 0x0, ...)
        /home/travis/gopath/pkg/mod/github.com/urfave/cli@v0.0.0-20161102131801-d86a009f5e13/command.go:191 +0x924
github.com/urfave/cli.(*App).RunAsSubcommand(0xc000180000, 0xc000021540, 0x0, 0x0)
        /home/travis/gopath/pkg/mod/github.com/urfave/cli@v0.0.0-20161102131801-d86a009f5e13/app.go:362 +0x7d6
github.com/urfave/cli.Command.startApp(0xa7958a, 0x3, 0x0, 0x0, 0xc0001466e0, 0x1, 0x1, 0xa8eaee, 0x20, 0x0, ...)
        /home/travis/gopath/pkg/mod/github.com/urfave/cli@v0.0.0-20161102131801-d86a009f5e13/command.go:278 +0x766
github.com/urfave/cli.Command.Run(0xa7958a, 0x3, 0x0, 0x0, 0xc0001466e0, 0x1, 0x1, 0xa8eaee, 0x20, 0x0, ...)
        /home/travis/gopath/pkg/mod/github.com/urfave/cli@v0.0.0-20161102131801-d86a009f5e13/command.go:79 +0x131e
github.com/urfave/cli.(*App).Run(0xc00009dba0, 0xc00001e0c0, 0x4, 0x4, 0x0, 0x0)
        /home/travis/gopath/pkg/mod/github.com/urfave/cli@v0.0.0-20161102131801-d86a009f5e13/app.go:241 +0x654
main.main()
        /home/travis/gopath/src/github.com/aelsabbahy/goss/cmd/goss/goss.go:401 +0x212e

Environment:

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.