Skip to content

feat: add basic TinyGo compat#382

Draft
pancsta wants to merge 1 commit into
mainfrom
feat/tinygo
Draft

feat: add basic TinyGo compat#382
pancsta wants to merge 1 commit into
mainfrom
feat/tinygo

Conversation

@pancsta
Copy link
Copy Markdown
Owner

@pancsta pancsta commented Mar 25, 2026

This PR adds TinyGo compatibility via codegen behind -tags=tinygo.

/pkg/machine seems to work well, but the lack of networking for WASI is a blocker for /pkg/rpc. Once solved, the serialization has to switch to andreyvit/tinyjson, with /pkg/rpc.(*Server) being able to handle both encodings within the same build tag.

Changes:

  • build tag split into *.big.go and *.tiny.go
  • codegen for schemas, handlers, and args
  • Machine.BindHandlerMaps(...)
  • v3 schema format
# /examples/tinygo
$ env GOTOOLCHAIN=go1.25.8 tinygo test -v ./
=== RUN   TestFileProcessing
    [state] +DownloadingFile
    [exter] Downloading file... 
    waiting: DownloadingFile to FileUploaded
    [state] +FileDownloaded -DownloadingFile
    [auto_] +ProcessingFile
    [exter] processFileActivity succeed /tmp/temporal_sample46331932
    [state] +FileProcessed -ProcessingFile
    [exter] cleanup /tmp/temporal_sample121180902
    [auto_] +UploadingFile
    [exter] uploadFileActivity begin /tmp/temporal_sample46331932
    [exter] uploadFileActivity succeed /tmp/temporal_sample46331932
    [state] +FileUploaded -UploadingFile
    [exter] cleanup /tmp/temporal_sample46331932
    (FileDownloaded:1 FileProcessed:1 FileUploaded:1)
    (FileDownloaded:1 FileProcessed:1 FileUploaded:1) [Exception:0 DownloadingFile:2 ProcessingFile:2 UploadingFile:2]
    
        0 Exception
            |Tick     0
        0 DownloadingFile
            |Tick     2
            |Remove   FileDownloaded
        1 FileDownloaded
            |Tick     1
            |Remove   DownloadingFile
        0 ProcessingFile
            |Tick     2
            |Auto     true
            |Require  FileDownloaded
            |Remove   FileProcessed
        1 FileProcessed
            |Tick     1
            |Remove   ProcessingFile
        0 UploadingFile
            |Tick     2
            |Auto     true
            |Require  FileProcessed
            |Remove   FileUploaded
        1 FileUploaded
            |Tick     1
            |Remove   UploadingFile
        
--- PASS: TestFileProcessing (0.20s)
PASS
ok      github.com/pancsta/asyncmachine-go/examples/tinygo      0.204s

TLDR; TinyGo is not Go

@pancsta pancsta changed the title feat: add basic tinygo compat feat: add basic TinyGo compat Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant