Skip to content

Cannot load honnef.co/go/js/dom/v2: no Go source files #70

@fannyhasbi

Description

@fannyhasbi

Hello, I'm trying to get this project for the first time. I used go mod for my project.

It's success to get the package mentioned using go get honnef.co/go/js/dom/v2 and when I check the folder it's exist with the following tree :

.
├── honnef.co
│   └── go
│       └── js
│           └── dom
│               └── v2
│                   ├── LICENSE
│                   ├── dom.go
│                   ├── events.go
│                   └── go.mod

But when I import it on my simple project it says

build command-line-arguments: cannot load honnef.co/go/js/dom/v2: no Go source files

This is my code

package main

import (
	"fmt"
	"honnef.co/go/js/dom/v2"
)

func main() {
	el := dom.GetWindow().Document().QuerySelector("#number1")
	htmlEl := el.(dom.HTMLElement)
	pEl := el.(*dom.HTMLParagraphElement)
	fmt.Println("Hello", pEl)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions