英文:
go lang too many arguments in call
问题
我正在增强这个 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: 调用 c.Run 时参数过多
我交叉检查了以下路径中的源代码:
/usr/local/go/src/collider
/usr/local/go/src/collidermain
一切都正常。不确定为什么会一直出现这个错误。
有什么想法吗?
英文:
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?
答案1
得分: 1
我在卸载Go之前终于修复了它。
我删除了/usr/local/go文件夹并重新安装。
注意:/usr/local/go/collider文件夹之前有我的更改,但collidermain仍然无法正确链接。可能是缓存的构建中间文件导致的?
英文:
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?
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论