Giter Site home page Giter Site logo

can't import fsm package about gomacro HOT 4 CLOSED

SuperGod avatar SuperGod commented on May 27, 2024
can't import fsm package

from gomacro.

Comments (4)

cosmos72 avatar cosmos72 commented on May 27, 2024

Thank for spotting this :)
I'll investigate this bug

from gomacro.

cosmos72 avatar cosmos72 commented on May 27, 2024

I've just rechecked this issue, and it seems to be working now (using Go toolchain <= 1.19, see issue #146).
Can you confirm?

from gomacro.

cosmos72 avatar cosmos72 commented on May 27, 2024

I re-checked after (hopefully) fixing issue #146, and now import "github.com/looplab/fsm" fails with:

gomacro> import "github.com/looplab/fsm"
// debug: running "go get github.com/looplab/fsm" ...
go: added github.com/looplab/fsm v1.0.1
// debug: running "go mod tidy" ...
// debug: compiling plugin "/home/max/go/src/gomacro.imports/gomacro_pid_28645/import_1" ...
Converter.Type(): unsupported types.Type: *types.TypeParam

This is because gomacro does not yet know about go/types.TypeParam which represents a type parameter for a Go generic.
I'll add support for them as soon as I have time.

from gomacro.

cosmos72 avatar cosmos72 commented on May 27, 2024

Commit 68a1200 skips generics when importing third-party packages,
because importing generics is not yet supported.

Now import "github.com/looplab/fsm" works:

gomacro> import "github.com/looplab/fsm"
// debug: running "go get github.com/looplab/fsm" ...
go: added github.com/looplab/fsm v1.0.1
// debug: running "go mod tidy" ...
// debug: compiling plugin "/home/max/go/src/gomacro.imports/gomacro_pid_19060/import_1" ...
// warning: skipping import of func sync.OnceValue[T any](f func() T) func() T: importing generic functions or types is not supported yet
// warning: skipping import of func sync.OnceValues[T1, T2 any](f func() (T1, T2)) func() (T1, T2):     importing generic functions or types is not supported yet

gomacro> :env fsm
// ----- "github.com/looplab/fsm" binds -----
FlowChart       = flowChart     // fsm.MermaidDiagramType
GRAPHVIZ        = graphviz      // fsm.VisualizeType
MERMAID         = mermaid       // fsm.VisualizeType
MermaidFlowChart                = mermaid-flow-chart    // fsm.VisualizeType
MermaidStateDiagram             = mermaid-state-diagram // fsm.VisualizeType
NewFSM          = 0x7f8eb4375380        // func(string, []fsm.EventDesc, map[string]fsm.Callback) *fsm.FSM
StateDiagram    = stateDiagram  // fsm.MermaidDiagramType
Visualize       = 0x7f8eb43782e0        // func(*fsm.FSM) string
VisualizeForMermaidWithGraphType                = 0x7f8eb43788c0        // func(*fsm.FSM, fsm.MermaidDiagramType) (string, error)
VisualizeWithType               = 0x7f8eb4379300        // func(*fsm.FSM, fsm.VisualizeType) (string, error)

// ----- "github.com/looplab/fsm" types -----
AsyncError      = fsm.AsyncError        // struct
Callback        = fsm.Callback  // func
Callbacks       = fsm.Callbacks // map
CanceledError   = fsm.CanceledError     // struct
Event           = fsm.Event     // struct
EventDesc       = fsm.EventDesc // struct
Events          = fsm.Events    // slice
FSM             = fsm.FSM       // struct
InTransitionError               = fsm.InTransitionError // struct
InternalError   = fsm.InternalError     // struct
InvalidEventError               = fsm.InvalidEventError // struct
MermaidDiagramType              = fsm.MermaidDiagramType        // string
NoTransitionError               = fsm.NoTransitionError // struct
NotInTransitionError            = fsm.NotInTransitionError      // struct
UnknownEventError               = fsm.UnknownEventError // struct
VisualizeType   = fsm.VisualizeType     // string

from gomacro.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.