: invalids operations in websock_js.go

I’m using go1.17.1 linux/amd64.

I want to build a web app using gRPC and wasm. To do so, I defined proto to implement server and client. Then I could use implemented function to communicate with database and grab content from this database to create my web app. The following code is contained in the file hycli.go :

package hycli

import (



	client "testGRPC/proto"

var (
	cli client.BackendClient

func Client() (cli client.BackendClient) {
	// build grpc URL
	href := js.Global().Get("location").Get("href")
	u, err := url.Parse(href.String())
	if err != nil {
		log.Fatal("invalid document location: ", href.String(), ": ", err)

	if u.Scheme == "http" {
		u.Scheme = "ws"
	} else {
		u.Scheme = "wss"

	u.Path = "/grpc-proxy"

	log.Print("grpc URL: ", u)

	//Dial setup
	const dialTO = 5 * time.Second
	dialCtx, _ := context.WithTimeout(context.Background(), dialTO)
	//dialCtx, dialCancel := context.WithTimeout(context.Background(), dialTO)
	//defer dialCancel()

	//Connect to remote gRPC server
	creds := credentials.NewTLS(&tls.Config{InsecureSkipVerify: true})
	cc, err := grpc.DialContext(dialCtx, "passthrough:///"+u.String(),

	if err != nil {
		log.Fatalf("Could not gRPC dial: %s; Details: %s", u.String(), err)

	cli = client.NewBackendClient(cc)

This file will be useful for all my go files intented for generating wasm files. For instance, here is mainPage.go :

package main

import (
	client "testGRPC/proto"


//go:generate bash -c "GOOS=js GOARCH=wasm go build -o ../src/mainPage.wasm ./mainPage.go"

var cli client.BackendClient

func main(){
	cli = hycli.Client()

	done := make(chan struct{})


        where we code javascript in go with syscall/js


Then I want to use the mainPage.wasm generated in templates (for instance a template index.tmpl). I tried to make this work for one go file (mainPage.go) but it did’nt work. My run script is the command modd with the following modd.conf :

modd.conf {}

go.mod go.sum **/*.go {
    prep: go build .

client/../*.go {
    prep: go generate ./client/...

testGRPC {
    daemon: ./testGRPC

(testGRPC is the name I gave to go.mod)

When I throw modd in a command prompt I have the following answer :

> 17:10:09: prep: go build .
>> done (198.713987ms)
17:10:10: prep: go generate ./client/...
/home/dev1/go/pkg/mod/ invalid operation: newBlob == jsUndefined (struct containing [0]func() cannot be compared)
/home/dev1/go/pkg/mod/ invalid operation: testBlob.Get("arrayBuffer") != jsUndefined (struct containing [0]func() cannot be compared)
/home/dev1/go/pkg/mod/ invalid operation: testBlob.Get("stream") != js.Undefined() (struct containing [0]func() cannot be compared)
client/wasm/mainPage.go:11: running "bash": exit status 2
exit status 1
17:10:10: daemon: ./testGRPC
>> starting...

I don’t understand why this answer and I’m sorry if my issue is stupid, I’m a beginner and I’m trying to understand what is happening. If you need more information to understand my issue please ask me, if you don’t have any solutions but can help me on wasm generation please enlighten me, I’ve been looking for help on internet all day long but I can’t find anything that I understand clearly.