Skip to content

Installation

go-libs is a Go module — it is imported directly into your Go project, not installed as a binary.

Requirements

  • Go 1.21 or later (module requires Go 1.26 to build from source)
  • A Go module initialized in your project (go mod init)

Add the dependency

go get gitlab.com/startx1/k8s/go-libs@latest

To pin a specific version:

go get gitlab.com/startx1/k8s/go-libs@v0.2.14

Then tidy your module:

go mod tidy

Import a package

Each package is imported independently. Import only what you need:

import (
    sxUtils  "gitlab.com/startx1/k8s/go-libs/pkg/utils"
    sxKcli   "gitlab.com/startx1/k8s/go-libs/pkg/k8sclient"
    sxMailer "gitlab.com/startx1/k8s/go-libs/pkg/mailer"
)

Available packages:

Import path Purpose
gitlab.com/startx1/k8s/go-libs/pkg/utils Display helpers, arg parser, debug flag
gitlab.com/startx1/k8s/go-libs/pkg/k8sclient Kubernetes client wrapper
gitlab.com/startx1/k8s/go-libs/pkg/kubeconfig Kubeconfig YAML load/save
gitlab.com/startx1/k8s/go-libs/pkg/prometheus Prometheus query client
gitlab.com/startx1/k8s/go-libs/pkg/incrementor Kubernetes resource.Quantity parser
gitlab.com/startx1/k8s/go-libs/pkg/mailer SMTP email with HTML and attachments
gitlab.com/startx1/k8s/go-libs/pkg/gdrive Google Drive / Sheets via service account
gitlab.com/startx1/k8s/go-libs/pkg/confluence Confluence Cloud REST API

Minimal example

package main

import (
    sxUtils "gitlab.com/startx1/k8s/go-libs/pkg/utils"
)

func main() {
    display := sxUtils.NewCmdDisplay("myapp")
    display.Info("Application started")
    sxUtils.SetDebug(true)
    display.Debug("Debug mode enabled")
}

Build from source

To build the sxlibs diagnostic binary:

git clone git@gitlab.com:startx1/k8s/go-libs.git
cd go-libs
make build
./bin/sxlibs version