1

I am using 2 go bindings for tdlib: each of them builds like 270seconds each time I change a line in my main.go file. TDLib is built using gcc. Is there a way not to rebuild it every time I change a line? I am using go build -v main.go command for it. I build TDLib using guide from https://tdlib.github.io/td/build.html

Go Example I'm building is

package main

import (
    "log"
    "path/filepath"

    "github.com/zelenin/go-tdlib/client"
)

func main() {
    authorizer := client.ClientAuthorizer()
    go client.CliInteractor(authorizer)
    const (
        // apiId   = MyApiID from my.telegram.org
        // apiHash = "My hash from my.telegram.org"
    )
    authorizer.TdlibParameters <- &client.TdlibParameters{
        UseTestDc:              false,
        DatabaseDirectory:      filepath.Join(".tdlib", "database"),
        FilesDirectory:         filepath.Join(".tdlib", "files"),
        UseFileDatabase:        true,
        UseChatInfoDatabase:    true,
        UseMessageDatabase:     true,
        UseSecretChats:         false,
        ApiId:                  apiId,
        ApiHash:                apiHash,
        SystemLanguageCode:     "en",
        DeviceModel:            "Server",
        SystemVersion:          "1.0.0",
        ApplicationVersion:     "1.0.0",
        EnableStorageOptimizer: true,
        IgnoreFileNames:        false,
    }
    logVerbosity := client.WithLogVerbosity(&client.SetLogVerbosityLevelRequest{
        NewVerbosityLevel: 0,
    })
    tdlibClient, err := client.NewClient(authorizer, logVerbosity)
    if err != nil {
        log.Fatalf("NewClient error: %s", err)
    }
    optionValue, err := tdlibClient.GetOption(&client.GetOptionRequest{
        Name: "version",
    })
    if err != nil {
        log.Fatalf("GetOption error: %s", err)
    }
    log.Printf("TDLib version: %s", optionValue.(*client.OptionValueString).Value)

    me, err := tdlibClient.GetMe()
    if err != nil {
        log.Fatalf("GetMe error: %s", err)
    }
    log.Printf("Me: %s %s [%s]", me.FirstName, me.LastName, me.Username)
    listener := tdlibClient.GetListener()
    defer listener.Close()

    for update := range listener.Updates {
        if update.GetClass() == client.ClassUpdate {
            log.Printf("%#v", update)
        }
    }

}

Then i use time go build -v main.go, and got this result:

time go build -v main.go
command-line-arguments
go build -v main.go  257.16s user 9.45s system 99% cpu 4:28.81 total

Is it possible to build concurrently (not with 1 CPU)? During rebuild it gets the same result, as I add some new lines. I want it to build much faster than 257s for one line change.

Fominykh Maxim
  • 485
  • 1
  • 6
  • 20

0 Answers0