sony / sonyflake

A distributed unique ID generator inspired by Twitter's Snowflake
MIT License
3.89k stars 304 forks source link

Can't create sonyflake in the `init()` function in ubuntu. #55

Closed ZenkieBear closed 4 months ago

ZenkieBear commented 4 months ago

I have a init function:

func init() {
    sf = sonyflake.NewSonyflake(sonyflake.Settings{
        StartTime: time.Now(),
    })
    if sf == nil {
        panic("sonyflake is not create")
    }
    fmt.Println("Sonyflake is initialized")
}

I works right on my macOS(M2) system.

Now I have to compile it to linux/amd64 architecture, when I put the compiled executable program to the Ubuntu system, it can't not be run, and into the panic("sonyflake is not create").

So that means sonyflake is not compatible with linux/amd64 architecture.

jpduckwo commented 4 months ago

@ZenkieBear what was the issue? We are seeing the same thing, we're thinking it's something to do with the docker build images we are using

ZenkieBear commented 4 months ago

@ZenkieBear what was the issue? We are seeing the same thing, we're thinking it's something to do with the docker build images we are using

That's a good solution, but now we are using crossing-compile to adapter different OS and platforms.

NidhoogJX commented 2 months ago

as a result ofissue57