You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Go语言向动态加载函数传递通道参数问题求助

Go插件动态加载函数传递chan参数遇到问题求助

我是Go语言和Go插件的新手,最近在给动态加载的函数传递chan对象时碰了壁——传int类型参数的时候一切正常,但换成chan就不行了,完全搞不懂哪里出问题了,麻烦各位大佬帮忙看看!

相关代码:

dataunit.go

package main

type DataUnit struct {
    i int
    s string
}

modcounter.go

package main

import (
    "fmt"
    // "strconv"
)

type module string

//func (m module) RunMod(i int) {
func (m module) RunMod(in <-chan *DataUnit) {
    //fmt.Println("Hello Universe " + strconv.Itoa(i))
    fmt.Println("Hello Universe ")
    n := <-...
}

内容的提问来源于stack exchange,提问作者martin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 09:09:21