tinygo-org / tinygo

Go compiler for small places. Microcontrollers, WebAssembly (WASM/WASI), and command-line tools. Based on LLVM.
https://tinygo.org
Other
15.49k stars 913 forks source link

build error: net/smtp module reports undefined: tls.Conn #4624

Open everyx opened 1 day ago

everyx commented 1 day ago
❯ tinygo run verifier.go 
# net/smtp
/usr/lib/go/src/net/smtp/smtp.go:72:24: undefined: tls.Conn
/usr/lib/go/src/net/smtp/smtp.go:172:25: undefined: tls.Conn
verifier.go ```go package main import ( "encoding/json" "fmt" emailVerifier "github.com/AfterShip/email-verifier" ) type Result struct { Data *emailVerifier.Result `json:"data"` Error error `json:"error"` } func (p Result) ToJson(result Result) (*string, error) { bytes, err := json.Marshal(result) if err != nil { fmt.Println("Error converting to JSON:", err) return nil, err } json := string(bytes) return &json, nil } //export add func verify(email string) string { var result Result verifier := emailVerifier.NewVerifier().EnableAutoUpdateDisposable() ret, err := verifier.Verify(email) if err != nil { result = Result{ Data: nil, Error: err, } } else { result = Result{ Data: ret, Error: nil, } } bytes, err := json.Marshal(result) if err != nil { fmt.Println("Error converting to JSON:", err) return fmt.Sprintf("{error:%s}", err.Error()) } return string(bytes) } func main() { fmt.Println(verify("test@example.com")) } ```