Search code examples
functiongowebrtccolliderapprtc

go lang too many arguments in call


I am enhancing this Golang project: https://github.com/webrtc/apprtc/blob/master/src/collider/collider/collider.go

I added new parameters to the Run method:

// Run starts the collider server and blocks the thread until the program exits.
func (c *Collider) Run(p int, useTls bool, cert string, key string) {
    http.Handle("/ws", websocket.Handler(c.wsHandler))
    http.HandleFunc("/status", c.httpStatusHandler)
    http.HandleFunc("/", c.httpHandler)

    var e error

and it is invoked from main.go:

https://github.com/webrtc/apprtc/blob/master/src/collider/collidermain/main.go

// run the program
func (p *program) run() {
    configuration := InitConfiguration()

    log.Printf("Running collider: tls = %t, port = %d, room_server=%s", 
                configuration.Tls, configuration.Port, configuration.RoomServer)

    c := collider.NewCollider(configuration.RoomServer)
    c.Run(configuration.Port, configuration.Tls, configuration.Cert, configuration.Key)
}

For some reasons I keep getting the below error:

/usr/local/go/src/collidermain/main.go:84: too many arguments in call to c.Run

I cross checked the src in: /usr/local/go/src/collider /usr/local/go/src/collidermain

Everything is fine. Not sure why this error keeps happening.

Any thoughts?


Solution

  • I finally fixed it before uninstalling go.

    I removed the /usr/local/go folder and reinstalled.

    Note: collider folder in /usr/local/go/collider had my changes previously and still collidermain didn't link properly with it. Must have been a cached build intermediates?