我正在增强这个 Golang 项目:https://github.com/webrtc/apprtc/blob/master/src/collider/collider/collider.go
我向 Run 方法添加了新参数:
// 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
它是从 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)
}
由于某些原因,我不断收到以下错误:
/usr/local/go/src/collidermain/main.go:84: too many arguments in call to c.Run
我在以下位置交叉检查了 src: /usr/local/go/src/对撞机 /usr/local/go/src/collidermain
一切都很好。不确定为什么会不断发生此错误。
有什么想法吗?
最佳答案
我终于在卸载 go 之前修复了它。
我删除了/usr/local/go 文件夹并重新安装。
注意:/usr/local/go/collider 中的 collider 文件夹之前有我的更改,但 collidermain 仍未与其正确链接。一定是缓存的构建中间体?
关于function - golang 调用中的参数太多,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44339166/