Skip to content

Missing stdlib symbols on Linux native: net/http.Server.ListenAndServeTLS and net.* APIs #5205

@M09Ic

Description

@M09Ic

What happened?

While porting a Linux native TinyGo app, I hit missing stdlib APIs in net/http and net that exist in the Go stdlib.

Compile-time failures on TinyGo 0.40.1 (linux/amd64):

s.ListenAndServeTLS undefined (type *http.Server has no field or method ListenAndServeTLS)
t.TLSClientConfig undefined (type *http.Transport has no field or method TLSClientConfig)
t.DisableKeepAlives undefined (type *http.Transport has no field or method DisableKeepAlives)
t.DialContext undefined (type *http.Transport has no field or method DialContext)

undefined: net.InvalidAddrError
undefined: net.InterfaceByName
undefined: net.FilePacketConn
undefined: net.ListenPacket

Reproducer

check_http.go:

package main

import "net/http"

func main() {
    s := &http.Server{}
    _ = s.ListenAndServeTLS

    t := &http.Transport{}
    _ = t.TLSClientConfig
    _ = t.DisableKeepAlives
    _ = t.DialContext
}

check_net.go:

package main

import (
    "net"
    "os"
)

func main() {
    var _ net.InvalidAddrError
    _, _ = net.InterfaceByName("lo")
    _, _ = net.FilePacketConn((*os.File)(nil))
    _, _ = net.ListenPacket("udp", ":0")
}

Build command:

tinygo build -tags noasm -no-debug ./check_http.go
tinygo build -tags noasm -no-debug ./check_net.go

Environment

  • tinygo version 0.40.1 linux/amd64 (LLVM 20.1.1)
  • host: Ubuntu 24.04 (WSL2)

Expected behavior

Either:

  1. Add these symbols/methods for stdlib compatibility on native Linux targets, or
  2. Document unsupported APIs at function level so users can feature-gate reliably.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions