repo stringlengths 6 47 | file_url stringlengths 77 269 | file_path stringlengths 5 186 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-07 08:35:43 2026-01-07 08:55:24 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
PacktPublishing/Machine-Learning-With-Go | https://github.com/PacktPublishing/Machine-Learning-With-Go/blob/8ce2d8a9e5880c3eda3dc012be6d016a04bdde69/Chapter07/anomaly_detection/example1/myprogram.go | Chapter07/anomaly_detection/example1/myprogram.go | package main
import (
"fmt"
"log"
"github.com/lytics/anomalyzer"
)
func main() {
// Initialize an AnomalyzerConf value with
// configurations such as which anomaly detection
// methods we want to use.
conf := &anomalyzer.AnomalyzerConf{
Sensitivity: 0.1,
UpperBound: 5,
LowerBound: anomalyzer.NA, // i... | go | MIT | 8ce2d8a9e5880c3eda3dc012be6d016a04bdde69 | 2026-01-07T09:46:00.525197Z | false |
PacktPublishing/Machine-Learning-With-Go | https://github.com/PacktPublishing/Machine-Learning-With-Go/blob/8ce2d8a9e5880c3eda3dc012be6d016a04bdde69/Chapter07/statistics/example2/myprogram.go | Chapter07/statistics/example2/myprogram.go | package main
import (
"log"
"math"
"os"
"github.com/gonum/plot"
"github.com/gonum/plot/plotter"
"github.com/gonum/plot/plotutil"
"github.com/gonum/plot/vg"
"github.com/gonum/stat"
"github.com/kniren/gota/dataframe"
)
func main() {
// Open the CSV file.
passengersFile, err := os.Open("AirPassengers.csv")
... | go | MIT | 8ce2d8a9e5880c3eda3dc012be6d016a04bdde69 | 2026-01-07T09:46:00.525197Z | false |
PacktPublishing/Machine-Learning-With-Go | https://github.com/PacktPublishing/Machine-Learning-With-Go/blob/8ce2d8a9e5880c3eda3dc012be6d016a04bdde69/Chapter07/statistics/example1/myprogram.go | Chapter07/statistics/example1/myprogram.go | package main
import (
"fmt"
"log"
"math"
"os"
"github.com/gonum/stat"
"github.com/kniren/gota/dataframe"
)
func main() {
// Open the CSV file.
passengersFile, err := os.Open("AirPassengers.csv")
if err != nil {
log.Fatal(err)
}
defer passengersFile.Close()
// Create a dataframe from the CSV file.
pa... | go | MIT | 8ce2d8a9e5880c3eda3dc012be6d016a04bdde69 | 2026-01-07T09:46:00.525197Z | false |
PacktPublishing/Machine-Learning-With-Go | https://github.com/PacktPublishing/Machine-Learning-With-Go/blob/8ce2d8a9e5880c3eda3dc012be6d016a04bdde69/Chapter07/statistics/example3/myprogram.go | Chapter07/statistics/example3/myprogram.go | package main
import (
"fmt"
"log"
"os"
"strconv"
"github.com/kniren/gota/dataframe"
"github.com/sajari/regression"
)
func main() {
// Open the CSV file.
passengersFile, err := os.Open("AirPassengers.csv")
if err != nil {
log.Fatal(err)
}
defer passengersFile.Close()
// Create a dataframe from the CSV... | go | MIT | 8ce2d8a9e5880c3eda3dc012be6d016a04bdde69 | 2026-01-07T09:46:00.525197Z | false |
PacktPublishing/Machine-Learning-With-Go | https://github.com/PacktPublishing/Machine-Learning-With-Go/blob/8ce2d8a9e5880c3eda3dc012be6d016a04bdde69/Chapter07/statistics/example4/myprogram.go | Chapter07/statistics/example4/myprogram.go | package main
import (
"log"
"os"
"strconv"
"github.com/gonum/plot"
"github.com/gonum/plot/plotter"
"github.com/gonum/plot/plotutil"
"github.com/gonum/plot/vg"
"github.com/kniren/gota/dataframe"
"github.com/sajari/regression"
)
func main() {
// Open the CSV file.
passengersFile, err := os.Open("AirPasseng... | go | MIT | 8ce2d8a9e5880c3eda3dc012be6d016a04bdde69 | 2026-01-07T09:46:00.525197Z | false |
PacktPublishing/Machine-Learning-With-Go | https://github.com/PacktPublishing/Machine-Learning-With-Go/blob/8ce2d8a9e5880c3eda3dc012be6d016a04bdde69/Chapter01/handling_data_gopher_style/example2/myprogram.go | Chapter01/handling_data_gopher_style/example2/myprogram.go | package main
import (
"encoding/csv"
"fmt"
"log"
"os"
"strconv"
)
func main() {
// Open the CSV.
f, err := os.Open("myfile.csv")
if err != nil {
log.Fatal(err)
}
// Read in the CSV records.
r := csv.NewReader(f)
records, err := r.ReadAll()
if err != nil {
log.Fatal(err)
}
// Get the maximum valu... | go | MIT | 8ce2d8a9e5880c3eda3dc012be6d016a04bdde69 | 2026-01-07T09:46:00.525197Z | false |
PacktPublishing/Machine-Learning-With-Go | https://github.com/PacktPublishing/Machine-Learning-With-Go/blob/8ce2d8a9e5880c3eda3dc012be6d016a04bdde69/Chapter01/json/example2/myprogram.go | Chapter01/json/example2/myprogram.go | package main
import (
"encoding/json"
"io/ioutil"
"log"
"net/http"
)
// citiBikeURL provides the station statuses of CitiBike bike sharing stations.
const citiBikeURL = "https://gbfs.citibikenyc.com/gbfs/en/station_status.json"
// stationData is used to unmarshal the JSON document returned form citiBikeURL.
type... | go | MIT | 8ce2d8a9e5880c3eda3dc012be6d016a04bdde69 | 2026-01-07T09:46:00.525197Z | false |
PacktPublishing/Machine-Learning-With-Go | https://github.com/PacktPublishing/Machine-Learning-With-Go/blob/8ce2d8a9e5880c3eda3dc012be6d016a04bdde69/Chapter01/json/example1/myprogram.go | Chapter01/json/example1/myprogram.go | package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
)
// citiBikeURL provides the station statuses of CitiBike bike sharing stations.
const citiBikeURL = "https://gbfs.citibikenyc.com/gbfs/en/station_status.json"
// stationData is used to unmarshal the JSON document returned form citiBikeUR... | go | MIT | 8ce2d8a9e5880c3eda3dc012be6d016a04bdde69 | 2026-01-07T09:46:00.525197Z | false |
PacktPublishing/Machine-Learning-With-Go | https://github.com/PacktPublishing/Machine-Learning-With-Go/blob/8ce2d8a9e5880c3eda3dc012be6d016a04bdde69/Chapter01/caching/example2/myprogram.go | Chapter01/caching/example2/myprogram.go | package main
import (
"fmt"
"log"
"github.com/boltdb/bolt"
)
func main() {
// Open an embedded.db data file in your current directory.
// It will be created if it doesn't exist.
db, err := bolt.Open("embedded.db", 0600, nil)
if err != nil {
log.Fatal(err)
}
defer db.Close()
// Create a "bucket" in the ... | go | MIT | 8ce2d8a9e5880c3eda3dc012be6d016a04bdde69 | 2026-01-07T09:46:00.525197Z | false |
PacktPublishing/Machine-Learning-With-Go | https://github.com/PacktPublishing/Machine-Learning-With-Go/blob/8ce2d8a9e5880c3eda3dc012be6d016a04bdde69/Chapter01/caching/example1/myprogram.go | Chapter01/caching/example1/myprogram.go | package main
import (
"fmt"
"time"
cache "github.com/patrickmn/go-cache"
)
func main() {
// Create a cache with a default expiration time of 5 minutes, and which
// purges expired items every 30 seconds
c := cache.New(5*time.Minute, 30*time.Second)
// Put a key and value into the cache.
c.Set("mykey", "myv... | go | MIT | 8ce2d8a9e5880c3eda3dc012be6d016a04bdde69 | 2026-01-07T09:46:00.525197Z | false |
PacktPublishing/Machine-Learning-With-Go | https://github.com/PacktPublishing/Machine-Learning-With-Go/blob/8ce2d8a9e5880c3eda3dc012be6d016a04bdde69/Chapter01/csv_files/example2/myprogram.go | Chapter01/csv_files/example2/myprogram.go | package main
import (
"encoding/csv"
"fmt"
"io"
"log"
"os"
)
func main() {
// Open the iris dataset file.
f, err := os.Open("../data/iris.csv")
if err != nil {
log.Fatal(err)
}
defer f.Close()
// Create a new CSV reader reading from the opened file.
reader := csv.NewReader(f)
reader.FieldsPerRecord =... | go | MIT | 8ce2d8a9e5880c3eda3dc012be6d016a04bdde69 | 2026-01-07T09:46:00.525197Z | false |
PacktPublishing/Machine-Learning-With-Go | https://github.com/PacktPublishing/Machine-Learning-With-Go/blob/8ce2d8a9e5880c3eda3dc012be6d016a04bdde69/Chapter01/csv_files/example1/myprogram.go | Chapter01/csv_files/example1/myprogram.go | package main
import (
"encoding/csv"
"fmt"
"log"
"os"
)
func main() {
// Open the iris dataset file.
f, err := os.Open("../data/iris.csv")
if err != nil {
log.Fatal(err)
}
defer f.Close()
// Create a new CSV reader reading from the opened file.
reader := csv.NewReader(f)
// Assume we don't know the n... | go | MIT | 8ce2d8a9e5880c3eda3dc012be6d016a04bdde69 | 2026-01-07T09:46:00.525197Z | false |
PacktPublishing/Machine-Learning-With-Go | https://github.com/PacktPublishing/Machine-Learning-With-Go/blob/8ce2d8a9e5880c3eda3dc012be6d016a04bdde69/Chapter01/csv_files/example3/myprogram.go | Chapter01/csv_files/example3/myprogram.go | package main
import (
"encoding/csv"
"fmt"
"io"
"log"
"os"
)
func main() {
// Open the iris dataset file.
f, err := os.Open("../data/iris_unexpected_fields.csv")
if err != nil {
log.Fatal(err)
}
defer f.Close()
// Create a new CSV reader reading from the opened file.
reader := csv.NewReader(f)
// We... | go | MIT | 8ce2d8a9e5880c3eda3dc012be6d016a04bdde69 | 2026-01-07T09:46:00.525197Z | false |
PacktPublishing/Machine-Learning-With-Go | https://github.com/PacktPublishing/Machine-Learning-With-Go/blob/8ce2d8a9e5880c3eda3dc012be6d016a04bdde69/Chapter01/csv_files/example6/myprogram.go | Chapter01/csv_files/example6/myprogram.go | package main
import (
"fmt"
"log"
"os"
"github.com/kniren/gota/dataframe"
)
func main() {
// Pull in the CSV file.
irisFile, err := os.Open("../data/iris_labeled.csv")
if err != nil {
log.Fatal(err)
}
defer irisFile.Close()
// Create a dataframe from the CSV file.
// The types of the columns will be i... | go | MIT | 8ce2d8a9e5880c3eda3dc012be6d016a04bdde69 | 2026-01-07T09:46:00.525197Z | false |
PacktPublishing/Machine-Learning-With-Go | https://github.com/PacktPublishing/Machine-Learning-With-Go/blob/8ce2d8a9e5880c3eda3dc012be6d016a04bdde69/Chapter01/csv_files/example5/myprogram.go | Chapter01/csv_files/example5/myprogram.go | package main
import (
"fmt"
"log"
"os"
"github.com/kniren/gota/dataframe"
)
func main() {
// Open the CSV file.
irisFile, err := os.Open("../data/iris_labeled.csv")
if err != nil {
log.Fatal(err)
}
defer irisFile.Close()
// Create a dataframe from the CSV file.
// The types of the columns will be infe... | go | MIT | 8ce2d8a9e5880c3eda3dc012be6d016a04bdde69 | 2026-01-07T09:46:00.525197Z | false |
PacktPublishing/Machine-Learning-With-Go | https://github.com/PacktPublishing/Machine-Learning-With-Go/blob/8ce2d8a9e5880c3eda3dc012be6d016a04bdde69/Chapter01/csv_files/example4/myprogram.go | Chapter01/csv_files/example4/myprogram.go | package main
import (
"encoding/csv"
"fmt"
"io"
"log"
"os"
"strconv"
)
// CSVRecord contains a sucessfully parsed row of the CSV file.
type CSVRecord struct {
SepalLength float64
SepalWidth float64
PetalLength float64
PetalWidth float64
Species string
ParseError error
}
func main() {
// Open the... | go | MIT | 8ce2d8a9e5880c3eda3dc012be6d016a04bdde69 | 2026-01-07T09:46:00.525197Z | false |
PacktPublishing/Machine-Learning-With-Go | https://github.com/PacktPublishing/Machine-Learning-With-Go/blob/8ce2d8a9e5880c3eda3dc012be6d016a04bdde69/Chapter01/sql-like_databases/example2/myprogram.go | Chapter01/sql-like_databases/example2/myprogram.go | package main
import (
"database/sql"
"fmt"
"log"
"os"
// pq is the libary that allows us to connect
// to postgres with databases/sql.
_ "github.com/lib/pq"
)
func main() {
// Get my postgres connection URL. I have it stored in
// an environmental variable.
pgURL := os.Getenv("PGURL")
if pgURL == "" {
... | go | MIT | 8ce2d8a9e5880c3eda3dc012be6d016a04bdde69 | 2026-01-07T09:46:00.525197Z | false |
PacktPublishing/Machine-Learning-With-Go | https://github.com/PacktPublishing/Machine-Learning-With-Go/blob/8ce2d8a9e5880c3eda3dc012be6d016a04bdde69/Chapter01/sql-like_databases/example1/myprogram.go | Chapter01/sql-like_databases/example1/myprogram.go | package main
import (
"database/sql"
"log"
"os"
// pq is the libary that allows us to connect
// to postgres with databases/sql.
_ "github.com/lib/pq"
)
func main() {
// Get the postgres connection URL. I have it stored in
// an environmental variable.
pgURL := os.Getenv("PGURL")
if pgURL == "" {
log.Fa... | go | MIT | 8ce2d8a9e5880c3eda3dc012be6d016a04bdde69 | 2026-01-07T09:46:00.525197Z | false |
PacktPublishing/Machine-Learning-With-Go | https://github.com/PacktPublishing/Machine-Learning-With-Go/blob/8ce2d8a9e5880c3eda3dc012be6d016a04bdde69/Chapter01/sql-like_databases/example3/myprogram.go | Chapter01/sql-like_databases/example3/myprogram.go | package main
import (
"database/sql"
"log"
"os"
// pq is the libary that allows us to connect
// to postgres with databases/sql.
_ "github.com/lib/pq"
)
func main() {
// Get my postgres connection URL. I have it stored in
// an environmental variable.
pgURL := os.Getenv("PGURL")
if pgURL == "" {
log.Fat... | go | MIT | 8ce2d8a9e5880c3eda3dc012be6d016a04bdde69 | 2026-01-07T09:46:00.525197Z | false |
PacktPublishing/Machine-Learning-With-Go | https://github.com/PacktPublishing/Machine-Learning-With-Go/blob/8ce2d8a9e5880c3eda3dc012be6d016a04bdde69/Chapter09/running_model_reliably/example2/myprogram.go | Chapter09/running_model_reliably/example2/myprogram.go | package main
import (
"encoding/csv"
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
"strconv"
"github.com/sajari/regression"
)
// ModelInfo includes the information about the
// model that is output from the training.
type ModelInfo struct {
Intercept float64 `json:"inter... | go | MIT | 8ce2d8a9e5880c3eda3dc012be6d016a04bdde69 | 2026-01-07T09:46:00.525197Z | false |
PacktPublishing/Machine-Learning-With-Go | https://github.com/PacktPublishing/Machine-Learning-With-Go/blob/8ce2d8a9e5880c3eda3dc012be6d016a04bdde69/Chapter09/running_model_reliably/example1/myprogram.go | Chapter09/running_model_reliably/example1/myprogram.go | package main
import (
"encoding/csv"
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
"strconv"
"github.com/sajari/regression"
)
// ModelInfo includes the information about the
// model that is output from the training.
type ModelInfo struct {
Intercept float64 `json:"inter... | go | MIT | 8ce2d8a9e5880c3eda3dc012be6d016a04bdde69 | 2026-01-07T09:46:00.525197Z | false |
PacktPublishing/Machine-Learning-With-Go | https://github.com/PacktPublishing/Machine-Learning-With-Go/blob/8ce2d8a9e5880c3eda3dc012be6d016a04bdde69/Chapter09/running_model_reliably/example3/myprogram.go | Chapter09/running_model_reliably/example3/myprogram.go | package main
import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
)
// ModelInfo includes the information about the
// model that is output from the training.
type ModelInfo struct {
Intercept float64 `json:"intercept"`
Coefficients []CoefficientInfo `json:"coefficients"`... | go | MIT | 8ce2d8a9e5880c3eda3dc012be6d016a04bdde69 | 2026-01-07T09:46:00.525197Z | false |
PacktPublishing/Machine-Learning-With-Go | https://github.com/PacktPublishing/Machine-Learning-With-Go/blob/8ce2d8a9e5880c3eda3dc012be6d016a04bdde69/Chapter09/building_a_scalable_pipeline/example2/myprogram.go | Chapter09/building_a_scalable_pipeline/example2/myprogram.go | package main
import (
"log"
"os"
"github.com/pachyderm/pachyderm/src/client"
)
func main() {
// Connect to Pachyderm on our localhost. By default
// Pachyderm will be exposed on port 30650.
c, err := client.NewFromAddress("0.0.0.0:30650")
if err != nil {
log.Fatal(err)
}
defer c.Close()
// Start a com... | go | MIT | 8ce2d8a9e5880c3eda3dc012be6d016a04bdde69 | 2026-01-07T09:46:00.525197Z | false |
PacktPublishing/Machine-Learning-With-Go | https://github.com/PacktPublishing/Machine-Learning-With-Go/blob/8ce2d8a9e5880c3eda3dc012be6d016a04bdde69/Chapter09/building_a_scalable_pipeline/example1/myprogram.go | Chapter09/building_a_scalable_pipeline/example1/myprogram.go | package main
import (
"log"
"github.com/pachyderm/pachyderm/src/client"
)
func main() {
// Connect to Pachyderm using the IP of our
// Kubernetes cluster. Here we will use localhost
// to mimic the sceneario when you have k8s running
// locally and/or you are forwarding the Pachyderm
// port to your localho... | go | MIT | 8ce2d8a9e5880c3eda3dc012be6d016a04bdde69 | 2026-01-07T09:46:00.525197Z | false |
viddotech/videoalchemy | https://github.com/viddotech/videoalchemy/blob/80464cd792003073d3de6bea10d95f19303d5e0a/cmd/compose/commands.go | cmd/compose/commands.go | package main
import (
"fmt"
"github.com/spf13/cobra"
"github.com/viddotech/videoalchemy/internal/domain/task/services"
"github.com/viddotech/videoalchemy/internal/infrastructure/compose"
"github.com/viddotech/videoalchemy/internal/infrastructure/pretty"
"os"
)
// These variables will be set at build time
var (
... | go | MIT | 80464cd792003073d3de6bea10d95f19303d5e0a | 2026-01-07T09:45:32.476716Z | false |
viddotech/videoalchemy | https://github.com/viddotech/videoalchemy/blob/80464cd792003073d3de6bea10d95f19303d5e0a/cmd/compose/log.go | cmd/compose/log.go | package main
import (
"github.com/fatih/color"
"github.com/sirupsen/logrus"
)
// VideoAlchemyLogFormatter is a Loggers formatter that adds color to log levels.
type VideoAlchemyLogFormatter struct {
logrus.TextFormatter
}
// Format formats the log entry with colors.
func (f *VideoAlchemyLogFormatter) Format(entry... | go | MIT | 80464cd792003073d3de6bea10d95f19303d5e0a | 2026-01-07T09:45:32.476716Z | false |
viddotech/videoalchemy | https://github.com/viddotech/videoalchemy/blob/80464cd792003073d3de6bea10d95f19303d5e0a/cmd/compose/main.go | cmd/compose/main.go | package main
import (
"github.com/sirupsen/logrus"
"github.com/viddotech/videoalchemy/internal/domain/task/services"
"os"
)
func main() {
taskService := services.TaskService{}
logrus.SetFormatter(&VideoAlchemyLogFormatter{
TextFormatter: logrus.TextFormatter{
FullTimestamp: true,
},
})
composeCommand... | go | MIT | 80464cd792003073d3de6bea10d95f19303d5e0a | 2026-01-07T09:45:32.476716Z | false |
viddotech/videoalchemy | https://github.com/viddotech/videoalchemy/blob/80464cd792003073d3de6bea10d95f19303d5e0a/internal/infrastructure/generate/files.go | internal/infrastructure/generate/files.go | package generate
import (
"fmt"
"github.com/viddotech/videoalchemy/internal/infrastructure/ffmpeg/schema"
"os"
)
func CreateConcatFilesList(files []schema.ConcatFile, filePath, InstructionName string) error {
// Create a list of files to concatenate
var concatFile string
for _, file := range files {
concatFil... | go | MIT | 80464cd792003073d3de6bea10d95f19303d5e0a | 2026-01-07T09:45:32.476716Z | false |
viddotech/videoalchemy | https://github.com/viddotech/videoalchemy/blob/80464cd792003073d3de6bea10d95f19303d5e0a/internal/infrastructure/pretty/text.go | internal/infrastructure/pretty/text.go | package pretty
import (
"fmt"
"github.com/fatih/color"
)
func NotifyNormalText(message string, keywords ...string) {
bold := color.New(color.FgCyan).Add(color.Bold).Add(color.Italic).SprintFunc()
c := color.New(color.FgHiWhite).SprintFunc()
boldKeywords := make([]interface{}, len(keywords))
for i, keyword := ra... | go | MIT | 80464cd792003073d3de6bea10d95f19303d5e0a | 2026-01-07T09:45:32.476716Z | false |
viddotech/videoalchemy | https://github.com/viddotech/videoalchemy/blob/80464cd792003073d3de6bea10d95f19303d5e0a/internal/infrastructure/ffmpeg/command/utils.go | internal/infrastructure/ffmpeg/command/utils.go | package command
import (
"fmt"
"github.com/viddotech/videoalchemy/internal/infrastructure/ffmpeg/schema"
"strings"
)
func getInputByID(id string, inputs []schema.Input) (int, *schema.Input) {
for index, input := range inputs {
if id == input.ID {
return index, &input
}
}
return 0, nil
}
func mapStreamT... | go | MIT | 80464cd792003073d3de6bea10d95f19303d5e0a | 2026-01-07T09:45:32.476716Z | false |
viddotech/videoalchemy | https://github.com/viddotech/videoalchemy/blob/80464cd792003073d3de6bea10d95f19303d5e0a/internal/infrastructure/ffmpeg/command/complex_filters.go | internal/infrastructure/ffmpeg/command/complex_filters.go | package command
import (
"fmt"
"github.com/viddotech/videoalchemy/internal/infrastructure/ffmpeg/schema"
"strings"
)
func GenerateComplexFilterParameters(inst schema.Instruction, noOutputProcessStreams []schema.ProcessStream) (string, error) {
var ffmpegString []string
for _, filter := range inst.ComplexFilters ... | go | MIT | 80464cd792003073d3de6bea10d95f19303d5e0a | 2026-01-07T09:45:32.476716Z | false |
viddotech/videoalchemy | https://github.com/viddotech/videoalchemy/blob/80464cd792003073d3de6bea10d95f19303d5e0a/internal/infrastructure/ffmpeg/command/streams.go | internal/infrastructure/ffmpeg/command/streams.go | package command
import (
"errors"
"fmt"
log "github.com/sirupsen/logrus"
"github.com/viddotech/videoalchemy/internal/infrastructure/ffmpeg/schema"
"os"
"path/filepath"
"strconv"
"strings"
)
func GenerateFFMPEGCommand(inst schema.Instruction, allInstructions []schema.Instruction) ([]string, error) {
var ffmpe... | go | MIT | 80464cd792003073d3de6bea10d95f19303d5e0a | 2026-01-07T09:45:32.476716Z | false |
viddotech/videoalchemy | https://github.com/viddotech/videoalchemy/blob/80464cd792003073d3de6bea10d95f19303d5e0a/internal/infrastructure/ffmpeg/schema/filter_complex.go | internal/infrastructure/ffmpeg/schema/filter_complex.go | package schema
type ComplexFilterItem struct {
Name string `validate:"oneof=select scale crop transpose vflip hflip rotate fps pad setpts eq hue brightness contrast gamma sharpness unsharp colorbalance lut colorchannelmixer overlay blend fade split tile geq noise negate curves boxblur gblur edgedetect vignette fade ... | go | MIT | 80464cd792003073d3de6bea10d95f19303d5e0a | 2026-01-07T09:45:32.476716Z | false |
viddotech/videoalchemy | https://github.com/viddotech/videoalchemy/blob/80464cd792003073d3de6bea10d95f19303d5e0a/internal/infrastructure/ffmpeg/schema/hls.go | internal/infrastructure/ffmpeg/schema/hls.go | package schema
type HLS struct {
Time float64 `yaml:"time"` // Duration of each segment in seconds
ListSize int `yaml:"list_size"` // Maximum number of entries in the playlist
S... | go | MIT | 80464cd792003073d3de6bea10d95f19303d5e0a | 2026-01-07T09:45:32.476716Z | false |
viddotech/videoalchemy | https://github.com/viddotech/videoalchemy/blob/80464cd792003073d3de6bea10d95f19303d5e0a/internal/infrastructure/ffmpeg/schema/filter_simple.go | internal/infrastructure/ffmpeg/schema/filter_simple.go | package schema
type VideoFilter struct {
Name string `validate:"oneof=select scale crop transpose vflip hflip rotate fps pad setpts eq hue brightness contrast gamma sharpness unsharp colorbalance lut colorchannelmixer overlay blend fade split tile geq noise negate curves boxblur gblur edgedetect vignette fade subtit... | go | MIT | 80464cd792003073d3de6bea10d95f19303d5e0a | 2026-01-07T09:45:32.476716Z | false |
viddotech/videoalchemy | https://github.com/viddotech/videoalchemy/blob/80464cd792003073d3de6bea10d95f19303d5e0a/internal/infrastructure/ffmpeg/schema/instruction.go | internal/infrastructure/ffmpeg/schema/instruction.go | package schema
type Instruction struct {
Name string `validate:"required" yaml:"name"`
Inputs []Input `validate:"dive" yaml:"inputs"`
ProcessStreams []ProcessStream `validate:"dive" yaml:"streams"`
Outputs []Output `validate:"dive" yaml:"outputs"`
ComplexFi... | go | MIT | 80464cd792003073d3de6bea10d95f19303d5e0a | 2026-01-07T09:45:32.476716Z | false |
viddotech/videoalchemy | https://github.com/viddotech/videoalchemy/blob/80464cd792003073d3de6bea10d95f19303d5e0a/internal/infrastructure/ffmpeg/schema/compose.go | internal/infrastructure/ffmpeg/schema/compose.go | package schema
type Version string
type Inspector struct {
Path string `yaml:"path"`
CommandType string `validate:"oneof=ffprobe,omitempty" yaml:"command_type"`
}
type ComposeFileSchema struct {
Version Version `yaml:"version" validate:"required,oneof=1.0 1"`
GeneratePath string `yaml:"g... | go | MIT | 80464cd792003073d3de6bea10d95f19303d5e0a | 2026-01-07T09:45:32.476716Z | false |
viddotech/videoalchemy | https://github.com/viddotech/videoalchemy/blob/80464cd792003073d3de6bea10d95f19303d5e0a/internal/infrastructure/ffmpeg/schema/output.go | internal/infrastructure/ffmpeg/schema/output.go | package schema
type Output struct {
ID string `validate:"required" yaml:"id"`
OverWrite bool `validate:"required" yaml:"overwrite"`
Source string `validate:"required" yaml:"source"`
StartNum uint `validate:"omitempty" yaml:"start_number"`
Length uint `validat... | go | MIT | 80464cd792003073d3de6bea10d95f19303d5e0a | 2026-01-07T09:45:32.476716Z | false |
viddotech/videoalchemy | https://github.com/viddotech/videoalchemy/blob/80464cd792003073d3de6bea10d95f19303d5e0a/internal/infrastructure/ffmpeg/schema/input.go | internal/infrastructure/ffmpeg/schema/input.go | package schema
type InputStream struct {
Index uint8
ID string
Type SelectorField
Data map[string]interface{}
}
type Input struct {
ID string `validate:"required" yaml:"id"`
Source string `validate:"required_without=OutputID" yaml:"source"`
OutputID string `validat... | go | MIT | 80464cd792003073d3de6bea10d95f19303d5e0a | 2026-01-07T09:45:32.476716Z | false |
viddotech/videoalchemy | https://github.com/viddotech/videoalchemy/blob/80464cd792003073d3de6bea10d95f19303d5e0a/internal/infrastructure/ffmpeg/schema/codec.go | internal/infrastructure/ffmpeg/schema/codec.go | package schema
type SelectorField string
type CodecName struct {
Video SelectorField `validate:"omitempty,oneof=libx264 libx265 mpeg2video libvpx-vp9 gif libvpx libaom-av1 mpeg1video mpeg4 h263 libtheora prores dnxhd libxvid msmpeg4v2 msmpeg4 wmv1 wmv2 vc1 flv rawvideo png bmp jpeg2000 mjpeg huffyuv liblags copy" ya... | go | MIT | 80464cd792003073d3de6bea10d95f19303d5e0a | 2026-01-07T09:45:32.476716Z | false |
viddotech/videoalchemy | https://github.com/viddotech/videoalchemy/blob/80464cd792003073d3de6bea10d95f19303d5e0a/internal/infrastructure/compose/loader.go | internal/infrastructure/compose/loader.go | package compose
import (
"bufio"
"encoding/json"
"errors"
"fmt"
"github.com/fatih/color"
"github.com/go-playground/locales/en"
ut "github.com/go-playground/universal-translator"
"github.com/go-playground/validator/v10"
enTranslations "github.com/go-playground/validator/v10/translations/en"
log "github.com/si... | go | MIT | 80464cd792003073d3de6bea10d95f19303d5e0a | 2026-01-07T09:45:32.476716Z | false |
viddotech/videoalchemy | https://github.com/viddotech/videoalchemy/blob/80464cd792003073d3de6bea10d95f19303d5e0a/internal/infrastructure/compose/validator.go | internal/infrastructure/compose/validator.go | package compose
import (
"github.com/go-playground/validator/v10"
vavalidate "github.com/viddotech/videoalchemy/internal/infrastructure/compose/validate"
"reflect"
"strings"
)
func NewValidator() (*validator.Validate, error) {
validate := validator.New()
for tag, function := range vavalidate.VideoAlchemyValida... | go | MIT | 80464cd792003073d3de6bea10d95f19303d5e0a | 2026-01-07T09:45:32.476716Z | false |
viddotech/videoalchemy | https://github.com/viddotech/videoalchemy/blob/80464cd792003073d3de6bea10d95f19303d5e0a/internal/infrastructure/compose/validate/cases.go | internal/infrastructure/compose/validate/cases.go | package validate
import (
"github.com/go-playground/validator/v10"
"github.com/viddotech/videoalchemy/internal/infrastructure/ffmpeg/schema"
"time"
)
var VideoAlchemyValidatorFunc = map[string]validator.Func{
REQUIRED_STREAM_FROM: validateStreamFromRequired,
VA_TIME: validateVATime,
CHECK_REFERENCE... | go | MIT | 80464cd792003073d3de6bea10d95f19303d5e0a | 2026-01-07T09:45:32.476716Z | false |
viddotech/videoalchemy | https://github.com/viddotech/videoalchemy/blob/80464cd792003073d3de6bea10d95f19303d5e0a/internal/infrastructure/compose/validate/errors.go | internal/infrastructure/compose/validate/errors.go | package validate
const (
REQUIRED_STREAM_FROM = "stream_from__required"
VA_TIME = "va_time"
CHECK_REFERENCES = "check_refs"
)
var MapErrorTags = map[string]string{
"required": "is required",
REQUIRED_STREAM_FROM: "one of input_id, filter_output_name, stream_name is required",
VA_TIME:... | go | MIT | 80464cd792003073d3de6bea10d95f19303d5e0a | 2026-01-07T09:45:32.476716Z | false |
viddotech/videoalchemy | https://github.com/viddotech/videoalchemy/blob/80464cd792003073d3de6bea10d95f19303d5e0a/internal/domain/task/services/task.go | internal/domain/task/services/task.go | package services
import (
"bufio"
"context"
"fmt"
"github.com/google/uuid"
log "github.com/sirupsen/logrus"
"github.com/viddotech/videoalchemy/internal/domain/task/entities"
"github.com/viddotech/videoalchemy/internal/infrastructure/ffmpeg/command"
"github.com/viddotech/videoalchemy/internal/infrastructure/ffm... | go | MIT | 80464cd792003073d3de6bea10d95f19303d5e0a | 2026-01-07T09:45:32.476716Z | false |
viddotech/videoalchemy | https://github.com/viddotech/videoalchemy/blob/80464cd792003073d3de6bea10d95f19303d5e0a/internal/domain/task/entities/task.go | internal/domain/task/entities/task.go | package entities
import (
"github.com/viddotech/videoalchemy/internal/infrastructure/ffmpeg/schema"
)
type TaskID string
type TaskStatus string
const (
STARTED TaskStatus = "STARTED"
RUNNING TaskStatus = "RUNNING"
DONE TaskStatus = "DONE"
FAILED TaskStatus = "FAILED"
)
type Task struct {
ID ... | go | MIT | 80464cd792003073d3de6bea10d95f19303d5e0a | 2026-01-07T09:45:32.476716Z | false |
viddotech/videoalchemy | https://github.com/viddotech/videoalchemy/blob/80464cd792003073d3de6bea10d95f19303d5e0a/constants/constants.go | constants/constants.go | package constants
const ()
| go | MIT | 80464cd792003073d3de6bea10d95f19303d5e0a | 2026-01-07T09:45:32.476716Z | false |
brizzbuzz/opnix | https://github.com/brizzbuzz/opnix/blob/eaacde99a78ef4fb10ee1a68513a98532611c882/cmd/opnix/token.go | cmd/opnix/token.go | // cmd/opnix/token.go
package main
import (
"bufio"
"flag"
"fmt"
"os"
"path/filepath"
"strings"
)
const tokenFileMode = 0600
type tokenCommand struct {
fs *flag.FlagSet
path string
action string
}
func newTokenCommand() *tokenCommand {
tc := &tokenCommand{
fs: flag.NewFlagSet("token", flag.ExitOnE... | go | MIT | eaacde99a78ef4fb10ee1a68513a98532611c882 | 2026-01-07T09:46:00.307407Z | false |
brizzbuzz/opnix | https://github.com/brizzbuzz/opnix/blob/eaacde99a78ef4fb10ee1a68513a98532611c882/cmd/opnix/secret.go | cmd/opnix/secret.go | package main
import (
"flag"
"fmt"
"log"
"os"
"github.com/brizzbuzz/opnix/internal/config"
"github.com/brizzbuzz/opnix/internal/errors"
"github.com/brizzbuzz/opnix/internal/onepass"
"github.com/brizzbuzz/opnix/internal/secrets"
"github.com/brizzbuzz/opnix/internal/systemd"
"github.com/brizzbuzz/opnix/intern... | go | MIT | eaacde99a78ef4fb10ee1a68513a98532611c882 | 2026-01-07T09:46:00.307407Z | false |
brizzbuzz/opnix | https://github.com/brizzbuzz/opnix/blob/eaacde99a78ef4fb10ee1a68513a98532611c882/cmd/opnix/main.go | cmd/opnix/main.go | package main
import (
"fmt"
"os"
"strings"
"github.com/brizzbuzz/opnix/internal/errors"
)
type command interface {
Name() string
Init([]string) error
Run() error
}
func main() {
cmds := []command{
newSecretCommand(),
newTokenCommand(),
}
if len(os.Args) < 2 {
printUsage(cmds)
os.Exit(1)
}
subc... | go | MIT | eaacde99a78ef4fb10ee1a68513a98532611c882 | 2026-01-07T09:46:00.307407Z | false |
brizzbuzz/opnix | https://github.com/brizzbuzz/opnix/blob/eaacde99a78ef4fb10ee1a68513a98532611c882/internal/validation/validator_test.go | internal/validation/validator_test.go | package validation
import (
"os"
"path/filepath"
"testing"
"github.com/brizzbuzz/opnix/internal/errors"
)
func TestValidator_ValidateConfig(t *testing.T) {
validator := NewValidator()
tests := []struct {
name string
secrets []SecretData
wantError bool
errorType string
}{
{
name: "emp... | go | MIT | eaacde99a78ef4fb10ee1a68513a98532611c882 | 2026-01-07T09:46:00.307407Z | false |
brizzbuzz/opnix | https://github.com/brizzbuzz/opnix/blob/eaacde99a78ef4fb10ee1a68513a98532611c882/internal/validation/validator.go | internal/validation/validator.go | package validation
import (
"fmt"
"os"
"os/user"
"regexp"
"strconv"
"strings"
"github.com/brizzbuzz/opnix/internal/errors"
)
// Validator provides comprehensive validation with helpful error messages
type Validator struct{}
// NewValidator creates a new validator instance
func NewValidator() *Validator {
re... | go | MIT | eaacde99a78ef4fb10ee1a68513a98532611c882 | 2026-01-07T09:46:00.307407Z | false |
brizzbuzz/opnix | https://github.com/brizzbuzz/opnix/blob/eaacde99a78ef4fb10ee1a68513a98532611c882/internal/systemd/integration_test.go | internal/systemd/integration_test.go | package systemd
import (
"encoding/json"
"os"
"path/filepath"
"testing"
"time"
"github.com/brizzbuzz/opnix/internal/config"
)
// mockSystemdIntegration creates a test systemd integration config
func mockSystemdIntegration() config.SystemdIntegration {
return config.SystemdIntegration{
Enable: true,... | go | MIT | eaacde99a78ef4fb10ee1a68513a98532611c882 | 2026-01-07T09:46:00.307407Z | false |
brizzbuzz/opnix | https://github.com/brizzbuzz/opnix/blob/eaacde99a78ef4fb10ee1a68513a98532611c882/internal/systemd/integration.go | internal/systemd/integration.go | package systemd
import (
"crypto/sha256"
"encoding/hex"
"encoding/json"
"fmt"
"io"
"os"
"os/exec"
"path/filepath"
"strings"
"time"
"github.com/brizzbuzz/opnix/internal/config"
"github.com/brizzbuzz/opnix/internal/errors"
)
// ServiceAction defines how to handle a service when secrets change
type ServiceA... | go | MIT | eaacde99a78ef4fb10ee1a68513a98532611c882 | 2026-01-07T09:46:00.307407Z | false |
brizzbuzz/opnix | https://github.com/brizzbuzz/opnix/blob/eaacde99a78ef4fb10ee1a68513a98532611c882/internal/onepass/client.go | internal/onepass/client.go | package onepass
import (
"context"
"fmt"
"os"
"strings"
"github.com/1password/onepassword-sdk-go"
"github.com/brizzbuzz/opnix/internal/errors"
)
type Client struct {
client *onepassword.Client
}
// GetToken retrieves token from environment or file
func GetToken(tokenFile string) (string, error) {
// First t... | go | MIT | eaacde99a78ef4fb10ee1a68513a98532611c882 | 2026-01-07T09:46:00.307407Z | false |
brizzbuzz/opnix | https://github.com/brizzbuzz/opnix/blob/eaacde99a78ef4fb10ee1a68513a98532611c882/internal/onepass/client_test.go | internal/onepass/client_test.go | package onepass
import (
"os"
"path/filepath"
"testing"
)
func TestGetToken(t *testing.T) {
// Create temp dir for test files
tmpDir, err := os.MkdirTemp("", "opnix-tests-*")
if err != nil {
t.Fatalf("Failed to create temp dir: %v", err)
}
defer os.RemoveAll(tmpDir)
// Tes... | go | MIT | eaacde99a78ef4fb10ee1a68513a98532611c882 | 2026-01-07T09:46:00.307407Z | false |
brizzbuzz/opnix | https://github.com/brizzbuzz/opnix/blob/eaacde99a78ef4fb10ee1a68513a98532611c882/internal/errors/errors_test.go | internal/errors/errors_test.go | package errors
import (
"fmt"
"strings"
"testing"
)
func TestOpnixError_Error(t *testing.T) {
tests := []struct {
name string
err *OpnixError
expected []string // Expected strings that should be in the output
}{
{
name: "Complete error with all fields",
err: &OpnixError{
Operation: "... | go | MIT | eaacde99a78ef4fb10ee1a68513a98532611c882 | 2026-01-07T09:46:00.307407Z | false |
brizzbuzz/opnix | https://github.com/brizzbuzz/opnix/blob/eaacde99a78ef4fb10ee1a68513a98532611c882/internal/errors/errors.go | internal/errors/errors.go | package errors
import (
"fmt"
"strings"
)
// OpnixError represents a structured error with context and suggestions
type OpnixError struct {
Operation string // What operation was being performed
Component string // Which component failed (config, onepass, secrets, etc.)
Issue string // The core i... | go | MIT | eaacde99a78ef4fb10ee1a68513a98532611c882 | 2026-01-07T09:46:00.307407Z | false |
brizzbuzz/opnix | https://github.com/brizzbuzz/opnix/blob/eaacde99a78ef4fb10ee1a68513a98532611c882/internal/secrets/processor.go | internal/secrets/processor.go | package secrets
import (
"fmt"
"os"
"os/user"
"path/filepath"
"strconv"
"strings"
"syscall"
"github.com/brizzbuzz/opnix/internal/config"
"github.com/brizzbuzz/opnix/internal/errors"
)
type SecretClient interface {
ResolveSecret(reference string) (string, error)
}
type ProcessResult struct {
SecretPaths ... | go | MIT | eaacde99a78ef4fb10ee1a68513a98532611c882 | 2026-01-07T09:46:00.307407Z | false |
brizzbuzz/opnix | https://github.com/brizzbuzz/opnix/blob/eaacde99a78ef4fb10ee1a68513a98532611c882/internal/secrets/processor_test.go | internal/secrets/processor_test.go | package secrets
import (
"fmt"
"os"
"path/filepath"
"runtime"
"testing"
"github.com/brizzbuzz/opnix/internal/config"
)
// Mock client for testing
type mockClient struct {
secrets map[string]string
}
func (m *mockClient) ResolveSecret(reference string) (string, error) {
if value, ok := m.secrets[reference]; ... | go | MIT | eaacde99a78ef4fb10ee1a68513a98532611c882 | 2026-01-07T09:46:00.307407Z | false |
brizzbuzz/opnix | https://github.com/brizzbuzz/opnix/blob/eaacde99a78ef4fb10ee1a68513a98532611c882/internal/types/types.go | internal/types/types.go | package types
// Secret represents a single secret configuration
type Secret struct {
Path string `json:"path"`
Reference string `json:"reference"`
Owner string `json:"owner,omitempty"`
Group string `json:"group,omitempty"`
Mode string `json:"mode,omitempty"`
}
// Config represents the complete... | go | MIT | eaacde99a78ef4fb10ee1a68513a98532611c882 | 2026-01-07T09:46:00.307407Z | false |
brizzbuzz/opnix | https://github.com/brizzbuzz/opnix/blob/eaacde99a78ef4fb10ee1a68513a98532611c882/internal/config/config.go | internal/config/config.go | package config
import (
"encoding/json"
"os"
"github.com/brizzbuzz/opnix/internal/errors"
"github.com/brizzbuzz/opnix/internal/validation"
)
type Secret struct {
Path string `json:"path"`
Reference string `json:"reference"`
Owner string `json:"owner,omitempty"`
Group... | go | MIT | eaacde99a78ef4fb10ee1a68513a98532611c882 | 2026-01-07T09:46:00.307407Z | false |
brizzbuzz/opnix | https://github.com/brizzbuzz/opnix/blob/eaacde99a78ef4fb10ee1a68513a98532611c882/internal/config/config_test.go | internal/config/config_test.go | package config
import (
"os"
"path/filepath"
"testing"
)
func TestLoad(t *testing.T) {
// Create temp config file
tmpDir, err := os.MkdirTemp("", "opnix-tests-*")
if err != nil {
t.Fatalf("Failed to create temp dir: %v", err)
}
defer os.RemoveAll(tmpDir)
configPath := filepath.Join(tmpDir, "config.json")
... | go | MIT | eaacde99a78ef4fb10ee1a68513a98532611c882 | 2026-01-07T09:46:00.307407Z | false |
fenio/pv-mounter | https://github.com/fenio/pv-mounter/blob/8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918/pkg/plugin/ssh_mount.go | pkg/plugin/ssh_mount.go | package plugin
import (
"context"
"fmt"
"net"
"os"
"os/exec"
"sync"
"time"
)
var (
tempKeyFiles = make(map[string]struct{})
tempKeyFilesMu sync.Mutex
)
// registerTempKeyFile registers a temporary key file for cleanup.
func registerTempKeyFile(path string) {
tempKeyFilesMu.Lock()
defer tempKeyFilesMu.Un... | go | Apache-2.0 | 8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918 | 2026-01-07T09:45:48.619634Z | false |
fenio/pv-mounter | https://github.com/fenio/pv-mounter/blob/8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918/pkg/plugin/utils.go | pkg/plugin/utils.go | package plugin
import (
crand "crypto/rand"
"crypto/x509"
"encoding/pem"
"crypto/ecdsa"
"crypto/elliptic"
"fmt"
"math/big"
"math/rand/v2"
"os"
"os/exec"
"path/filepath"
"regexp"
"runtime"
"strings"
"golang.org/x/crypto/ssh"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
)
// kube... | go | Apache-2.0 | 8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918 | 2026-01-07T09:45:48.619634Z | false |
fenio/pv-mounter | https://github.com/fenio/pv-mounter/blob/8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918/pkg/plugin/pod_setup.go | pkg/plugin/pod_setup.go | package plugin
import (
"context"
"fmt"
"strconv"
"time"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/kubernetes"
)
// setupPod creates a new pod for exposing a PVC via SSH.
func setupPo... | go | Apache-2.0 | 8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918 | 2026-01-07T09:45:48.619634Z | false |
fenio/pv-mounter | https://github.com/fenio/pv-mounter/blob/8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918/pkg/plugin/mount_rwo.go | pkg/plugin/mount_rwo.go | package plugin
import (
"context"
"k8s.io/client-go/kubernetes"
)
// handleRWO handles mounting of RWO (ReadWriteOnce) volumes that are already mounted.
func handleRWO(ctx context.Context, clientset *kubernetes.Clientset, namespace, pvcName, localMountPoint string, podUsingPVC string, needsRoot, debug bool, image,... | go | Apache-2.0 | 8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918 | 2026-01-07T09:45:48.619634Z | false |
fenio/pv-mounter | https://github.com/fenio/pv-mounter/blob/8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918/pkg/plugin/clean.go | pkg/plugin/clean.go | // Package plugin implements the core functionality for mounting and cleaning PVCs.
package plugin
import (
"context"
"fmt"
"os"
"os/exec"
"runtime"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
)
// Clean unmounts a PVC and removes associated resources including proxy pods and p... | go | Apache-2.0 | 8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918 | 2026-01-07T09:45:48.619634Z | false |
fenio/pv-mounter | https://github.com/fenio/pv-mounter/blob/8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918/pkg/plugin/utils_test.go | pkg/plugin/utils_test.go | package plugin
import (
// Necessary imports
"crypto/elliptic"
"strings"
"testing"
)
func TestRandSeq(t *testing.T) {
length := 10
seq := randSeq(length)
if len(seq) != length {
t.Errorf("Expected length %d, got %d", length, len(seq))
}
allowedChars := "abcdefghijklmnopqrstuvwxyz0123456789"
for _, char :=... | go | Apache-2.0 | 8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918 | 2026-01-07T09:45:48.619634Z | false |
fenio/pv-mounter | https://github.com/fenio/pv-mounter/blob/8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918/pkg/plugin/mount_rwx.go | pkg/plugin/mount_rwx.go | package plugin
import (
"context"
"k8s.io/client-go/kubernetes"
)
// handleRWX handles mounting of RWX (ReadWriteMany) or unmounted RWO volumes.
func handleRWX(ctx context.Context, clientset *kubernetes.Clientset, namespace, pvcName, localMountPoint string, needsRoot, debug bool, image, imageSecret, cpuLimit strin... | go | Apache-2.0 | 8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918 | 2026-01-07T09:45:48.619634Z | false |
fenio/pv-mounter | https://github.com/fenio/pv-mounter/blob/8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918/pkg/plugin/mount_test.go | pkg/plugin/mount_test.go | package plugin
import (
"context"
"fmt"
"os"
"os/exec"
"slices"
"testing"
"time"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/kubernetes/fake"
k8stesting "k8s.io/client-go/testing"
)
func TestValidateMountPoint(t *testing.T)... | go | Apache-2.0 | 8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918 | 2026-01-07T09:45:48.619634Z | true |
fenio/pv-mounter | https://github.com/fenio/pv-mounter/blob/8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918/pkg/plugin/mount.go | pkg/plugin/mount.go | package plugin
import (
"context"
"crypto/elliptic"
crand "crypto/rand"
"fmt"
"math/big"
"os"
"os/signal"
"slices"
"sync"
"syscall"
"time"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
)
const (
// ImageVersion specifies the container image ver... | go | Apache-2.0 | 8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918 | 2026-01-07T09:45:48.619634Z | false |
fenio/pv-mounter | https://github.com/fenio/pv-mounter/blob/8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918/pkg/plugin/clean_test.go | pkg/plugin/clean_test.go | package plugin
import (
"context"
"testing"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes/fake"
)
func TestKillProcessInEphemeralContainer(t *testing.T) {
namespace := "default"
podName := "test-pod"
t.Run("Pod with ephemeral containers", func(t *test... | go | Apache-2.0 | 8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918 | 2026-01-07T09:45:48.619634Z | false |
fenio/pv-mounter | https://github.com/fenio/pv-mounter/blob/8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918/pkg/plugin/ephemeral.go | pkg/plugin/ephemeral.go | package plugin
import (
"context"
"encoding/json"
"fmt"
"strconv"
"time"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/kubernetes"
)
// createEphemeralContainer creates an ephemeral container i... | go | Apache-2.0 | 8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918 | 2026-01-07T09:45:48.619634Z | false |
fenio/pv-mounter | https://github.com/fenio/pv-mounter/blob/8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918/cmd/plugin/main.go | cmd/plugin/main.go | // Package main is the entry point for the pv-mounter kubectl plugin.
package main
import (
"github.com/fenio/pv-mounter/cmd/plugin/cli"
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp" // required for GKE
)
func main() {
cli.InitAndExecute()
}
| go | Apache-2.0 | 8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918 | 2026-01-07T09:45:48.619634Z | false |
fenio/pv-mounter | https://github.com/fenio/pv-mounter/blob/8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918/cmd/plugin/docs/docs.go | cmd/plugin/docs/docs.go | // Package main generates CLI documentation for pv-mounter.
package main
import (
"log"
"os"
"github.com/fenio/pv-mounter/cmd/plugin/cli"
"github.com/spf13/cobra/doc"
)
func main() {
outputDir := "./docs"
if err := os.MkdirAll(outputDir, 0750); err != nil {
log.Fatalf("Failed to create docs directory: %v", e... | go | Apache-2.0 | 8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918 | 2026-01-07T09:45:48.619634Z | false |
fenio/pv-mounter | https://github.com/fenio/pv-mounter/blob/8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918/cmd/plugin/cli/root.go | cmd/plugin/cli/root.go | package cli
import (
"fmt"
"os"
"path/filepath"
"strings"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"k8s.io/cli-runtime/pkg/genericclioptions"
)
// KubernetesConfigFlags holds the Kubernetes client configuration flags
var KubernetesConfigFlags *genericclioptions.ConfigFlags
var rootCmd *cobra.Command
... | go | Apache-2.0 | 8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918 | 2026-01-07T09:45:48.619634Z | false |
fenio/pv-mounter | https://github.com/fenio/pv-mounter/blob/8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918/cmd/plugin/cli/root_test.go | cmd/plugin/cli/root_test.go | package cli
import (
"os"
"testing"
)
func TestRootCmd(t *testing.T) {
cmd := RootCmd()
if cmd.Use != "pv-mounter" {
t.Errorf("Expected Use to be 'pv-mounter', got '%s'", cmd.Use)
}
if cmd.Short == "" {
t.Error("Expected Short description to be set")
}
if cmd.Long == "" {
t.Error("Expected Long descr... | go | Apache-2.0 | 8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918 | 2026-01-07T09:45:48.619634Z | false |
fenio/pv-mounter | https://github.com/fenio/pv-mounter/blob/8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918/cmd/plugin/cli/clean.go | cmd/plugin/cli/clean.go | // Package cli implements the command-line interface for pv-mounter.
package cli
import (
"context"
"fmt"
"github.com/fenio/pv-mounter/pkg/plugin"
"github.com/spf13/cobra"
)
func cleanCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "clean <namespace> <pvc-name> <local-mount-point>",
Short: "Clean up re... | go | Apache-2.0 | 8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918 | 2026-01-07T09:45:48.619634Z | false |
fenio/pv-mounter | https://github.com/fenio/pv-mounter/blob/8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918/cmd/plugin/cli/mount_test.go | cmd/plugin/cli/mount_test.go | package cli
import (
"os"
"testing"
)
func TestMountCmd(t *testing.T) {
cmd := mountCmd()
if cmd.Use != "mount [flags] <namespace> <pvc-name> <local-mount-point>" {
t.Errorf("Expected Use to be 'mount [flags] <namespace> <pvc-name> <local-mount-point>', got '%s'", cmd.Use)
}
if cmd.Short == "" {
t.Error("... | go | Apache-2.0 | 8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918 | 2026-01-07T09:45:48.619634Z | false |
fenio/pv-mounter | https://github.com/fenio/pv-mounter/blob/8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918/cmd/plugin/cli/mount.go | cmd/plugin/cli/mount.go | package cli
import (
"context"
"fmt"
"os"
"strconv"
"github.com/fenio/pv-mounter/pkg/plugin"
"github.com/spf13/cobra"
)
func parseBoolEnv(envName string, currentValue bool) (bool, error) {
env, exists := os.LookupEnv(envName)
if !exists {
return currentValue, nil
}
parsed, err := strconv.ParseBool(env)
... | go | Apache-2.0 | 8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918 | 2026-01-07T09:45:48.619634Z | false |
fenio/pv-mounter | https://github.com/fenio/pv-mounter/blob/8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918/cmd/plugin/cli/clean_test.go | cmd/plugin/cli/clean_test.go | package cli
import (
"testing"
)
func TestCleanCmd(t *testing.T) {
cmd := cleanCmd()
if cmd.Use != "clean <namespace> <pvc-name> <local-mount-point>" {
t.Errorf("Expected Use to be 'clean <namespace> <pvc-name> <local-mount-point>', got '%s'", cmd.Use)
}
if cmd.Short == "" {
t.Error("Expected Short descrip... | go | Apache-2.0 | 8e87f3adf2ce3200ac8a31a57d1ad2ad4d9ac918 | 2026-01-07T09:45:48.619634Z | false |
stolostron/multicluster-observability-operator | https://github.com/stolostron/multicluster-observability-operator/blob/a116fae78ab8eb55e54c9a9bdabdc478c9a309be/scripts/copyright/copyright.go | scripts/copyright/copyright.go | // Copyright (c) Red Hat, Inc.
// Copyright Contributors to the Open Cluster Management project
// Licensed under the Apache License 2.0
package main
import (
"bytes"
"log"
"os"
"path/filepath"
"strings"
)
type copyright []byte
var (
stolostron copyright = []byte(`// Copyright (c) Red Hat, Inc.
// Copyright C... | go | Apache-2.0 | a116fae78ab8eb55e54c9a9bdabdc478c9a309be | 2026-01-07T09:45:49.228954Z | false |
stolostron/multicluster-observability-operator | https://github.com/stolostron/multicluster-observability-operator/blob/a116fae78ab8eb55e54c9a9bdabdc478c9a309be/tools/simulator/alert-forward/main.go | tools/simulator/alert-forward/main.go | // Copyright (c) Red Hat, Inc.
// Copyright Contributors to the Open Cluster Management project
// Licensed under the Apache License 2.0
package main
import (
"bytes"
"context"
"errors"
"fmt"
"io"
"log"
"net/http"
"net/http/httptrace"
"net/url"
"os"
"os/signal"
"strings"
"sync"
"syscall"
"time"
confi... | go | Apache-2.0 | a116fae78ab8eb55e54c9a9bdabdc478c9a309be | 2026-01-07T09:45:49.228954Z | false |
stolostron/multicluster-observability-operator | https://github.com/stolostron/multicluster-observability-operator/blob/a116fae78ab8eb55e54c9a9bdabdc478c9a309be/proxy/pkg/util/util.go | proxy/pkg/util/util.go | // Copyright (c) Red Hat, Inc.
// Copyright Contributors to the Open Cluster Management project
// Licensed under the Apache License 2.0
package util
import (
"context"
"fmt"
projectv1 "github.com/openshift/api/project/v1"
userv1 "github.com/openshift/api/user/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
)
... | go | Apache-2.0 | a116fae78ab8eb55e54c9a9bdabdc478c9a309be | 2026-01-07T09:45:49.228954Z | false |
stolostron/multicluster-observability-operator | https://github.com/stolostron/multicluster-observability-operator/blob/a116fae78ab8eb55e54c9a9bdabdc478c9a309be/proxy/pkg/util/util_test.go | proxy/pkg/util/util_test.go | // Copyright (c) Red Hat, Inc.
// Copyright Contributors to the Open Cluster Management project
// Licensed under the Apache License 2.0
package util
import (
"context"
"testing"
projectv1 "github.com/openshift/api/project/v1"
userv1 "github.com/openshift/api/user/v1"
"github.com/stretchr/testify/assert"
metav... | go | Apache-2.0 | a116fae78ab8eb55e54c9a9bdabdc478c9a309be | 2026-01-07T09:45:49.228954Z | false |
stolostron/multicluster-observability-operator | https://github.com/stolostron/multicluster-observability-operator/blob/a116fae78ab8eb55e54c9a9bdabdc478c9a309be/proxy/pkg/proxy/tls_test.go | proxy/pkg/proxy/tls_test.go | // Copyright (c) Red Hat, Inc.
// Copyright Contributors to the Open Cluster Management project
// Licensed under the Apache License 2.0
package proxy
import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
"fmt"
"math/big"
"os"
"path/filepath"
"testing"
"ti... | go | Apache-2.0 | a116fae78ab8eb55e54c9a9bdabdc478c9a309be | 2026-01-07T09:45:49.228954Z | false |
stolostron/multicluster-observability-operator | https://github.com/stolostron/multicluster-observability-operator/blob/a116fae78ab8eb55e54c9a9bdabdc478c9a309be/proxy/pkg/proxy/proxy.go | proxy/pkg/proxy/proxy.go | // Copyright (c) Red Hat, Inc.
// Copyright Contributors to the Open Cluster Management project
// Licensed under the Apache License 2.0
package proxy
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
"net/http/httputil"
"net/url"
"path"
"strings"
"k8s.io/client-go/rest"
"k8s.io/klog/v2"
"... | go | Apache-2.0 | a116fae78ab8eb55e54c9a9bdabdc478c9a309be | 2026-01-07T09:45:49.228954Z | false |
stolostron/multicluster-observability-operator | https://github.com/stolostron/multicluster-observability-operator/blob/a116fae78ab8eb55e54c9a9bdabdc478c9a309be/proxy/pkg/proxy/proxy_test.go | proxy/pkg/proxy/proxy_test.go | // Copyright (c) Red Hat, Inc.
// Copyright Contributors to the Open Cluster Management project
// Licensed under the Apache License 2.0
package proxy
import (
"crypto/tls"
"io"
"net/http"
"net/http/httptest"
"net/url"
"regexp"
"slices"
"strings"
"testing"
"time"
projectv1 "github.com/openshift/api/projec... | go | Apache-2.0 | a116fae78ab8eb55e54c9a9bdabdc478c9a309be | 2026-01-07T09:45:49.228954Z | false |
stolostron/multicluster-observability-operator | https://github.com/stolostron/multicluster-observability-operator/blob/a116fae78ab8eb55e54c9a9bdabdc478c9a309be/proxy/pkg/proxy/tls.go | proxy/pkg/proxy/tls.go | // Copyright (c) Red Hat, Inc.
// Copyright Contributors to the Open Cluster Management project
// Licensed under the Apache License 2.0
package proxy
import (
"crypto/tls"
"crypto/x509"
"net"
"net/http"
"os"
"path/filepath"
"reflect"
"sync"
"time"
"github.com/cenkalti/backoff/v4"
"k8s.io/klog"
)
// TLSO... | go | Apache-2.0 | a116fae78ab8eb55e54c9a9bdabdc478c9a309be | 2026-01-07T09:45:49.228954Z | false |
stolostron/multicluster-observability-operator | https://github.com/stolostron/multicluster-observability-operator/blob/a116fae78ab8eb55e54c9a9bdabdc478c9a309be/proxy/pkg/cache/user_project.go | proxy/pkg/cache/user_project.go | // Copyright (c) Red Hat, Inc.
// Copyright Contributors to the Open Cluster Management project
// Licensed under the Apache License 2.0
// Package cache provides a thread-safe, in-memory cache to store the list of projects a user has access to.
// It uses the user's authentication token, which is forwarded by Grafana... | go | Apache-2.0 | a116fae78ab8eb55e54c9a9bdabdc478c9a309be | 2026-01-07T09:45:49.228954Z | false |
stolostron/multicluster-observability-operator | https://github.com/stolostron/multicluster-observability-operator/blob/a116fae78ab8eb55e54c9a9bdabdc478c9a309be/proxy/pkg/cache/user_project_test.go | proxy/pkg/cache/user_project_test.go | // Copyright (c) Red Hat, Inc.
// Copyright Contributors to the Open Cluster Management project
// Licensed under the Apache License 2.0
package cache
import (
"context"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestGetUserProjectList(t *testing.T) {
testCases := []struct {
name str... | go | Apache-2.0 | a116fae78ab8eb55e54c9a9bdabdc478c9a309be | 2026-01-07T09:45:49.228954Z | false |
stolostron/multicluster-observability-operator | https://github.com/stolostron/multicluster-observability-operator/blob/a116fae78ab8eb55e54c9a9bdabdc478c9a309be/proxy/pkg/health/health.go | proxy/pkg/health/health.go | // Copyright (c) Red Hat, Inc.
// Copyright Contributors to the Open Cluster Management project
// Licensed under the Apache License 2.0
package health
import (
"context"
"fmt"
"net/http"
"net/url"
"time"
"github.com/stolostron/multicluster-observability-operator/proxy/pkg/informer"
"k8s.io/klog/v2"
)
// Che... | go | Apache-2.0 | a116fae78ab8eb55e54c9a9bdabdc478c9a309be | 2026-01-07T09:45:49.228954Z | false |
stolostron/multicluster-observability-operator | https://github.com/stolostron/multicluster-observability-operator/blob/a116fae78ab8eb55e54c9a9bdabdc478c9a309be/proxy/pkg/health/health_test.go | proxy/pkg/health/health_test.go | // Copyright (c) Red Hat, Inc.
// Copyright Contributors to the Open Cluster Management project
// Licensed under the Apache License 2.0
package health
import (
"net/http"
"net/http/httptest"
"net/url"
"testing"
"github.com/stretchr/testify/assert"
)
// MockManagedClusterInformer is a mock implementation of th... | go | Apache-2.0 | a116fae78ab8eb55e54c9a9bdabdc478c9a309be | 2026-01-07T09:45:49.228954Z | false |
stolostron/multicluster-observability-operator | https://github.com/stolostron/multicluster-observability-operator/blob/a116fae78ab8eb55e54c9a9bdabdc478c9a309be/proxy/pkg/metricquery/modifier.go | proxy/pkg/metricquery/modifier.go | // Copyright (c) Red Hat, Inc.
// Copyright Contributors to the Open Cluster Management project
// Licensed under the Apache License 2.0
// Package metricquery is responsible for modifying incoming Prometheus queries to enforce multicluster
// Role-Based Access Control (RBAC). It inspects the user's permissions and in... | go | Apache-2.0 | a116fae78ab8eb55e54c9a9bdabdc478c9a309be | 2026-01-07T09:45:49.228954Z | false |
stolostron/multicluster-observability-operator | https://github.com/stolostron/multicluster-observability-operator/blob/a116fae78ab8eb55e54c9a9bdabdc478c9a309be/proxy/pkg/metricquery/filter.go | proxy/pkg/metricquery/filter.go | // Copyright (c) Red Hat, Inc.
// Copyright Contributors to the Open Cluster Management project
// Licensed under the Apache License 2.0
package metricquery
import (
"fmt"
"maps"
"regexp"
"slices"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/promql/parser"
"github.com/stol... | go | Apache-2.0 | a116fae78ab8eb55e54c9a9bdabdc478c9a309be | 2026-01-07T09:45:49.228954Z | false |
stolostron/multicluster-observability-operator | https://github.com/stolostron/multicluster-observability-operator/blob/a116fae78ab8eb55e54c9a9bdabdc478c9a309be/proxy/pkg/metricquery/filter_test.go | proxy/pkg/metricquery/filter_test.go | // Copyright (c) Red Hat, Inc.
// Copyright Contributors to the Open Cluster Management project
// Licensed under the Apache License 2.0
package metricquery
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestGetClustersInQuery(t *testing.T) {
userMetricsAccess := map[string][]string{
"cluster1"... | go | Apache-2.0 | a116fae78ab8eb55e54c9a9bdabdc478c9a309be | 2026-01-07T09:45:49.228954Z | false |
stolostron/multicluster-observability-operator | https://github.com/stolostron/multicluster-observability-operator/blob/a116fae78ab8eb55e54c9a9bdabdc478c9a309be/proxy/pkg/metricquery/modifier_test.go | proxy/pkg/metricquery/modifier_test.go | // Copyright (c) Red Hat, Inc.
// Copyright Contributors to the Open Cluster Management project
// Licensed under the Apache License 2.0
package metricquery
import (
"context"
"net/http"
"net/url"
"testing"
"time"
"github.com/stolostron/multicluster-observability-operator/proxy/pkg/cache"
proxyconfig "github.... | go | Apache-2.0 | a116fae78ab8eb55e54c9a9bdabdc478c9a309be | 2026-01-07T09:45:49.228954Z | false |
stolostron/multicluster-observability-operator | https://github.com/stolostron/multicluster-observability-operator/blob/a116fae78ab8eb55e54c9a9bdabdc478c9a309be/proxy/pkg/informer/informer_test.go | proxy/pkg/informer/informer_test.go | // Copyright (c) Red Hat, Inc.
// Copyright Contributors to the Open Cluster Management project
// Licensed under the Apache License 2.0
package informer
import (
"context"
"testing"
"time"
proxyconfig "github.com/stolostron/multicluster-observability-operator/proxy/pkg/config"
"github.com/stretchr/testify/asse... | go | Apache-2.0 | a116fae78ab8eb55e54c9a9bdabdc478c9a309be | 2026-01-07T09:45:49.228954Z | false |
stolostron/multicluster-observability-operator | https://github.com/stolostron/multicluster-observability-operator/blob/a116fae78ab8eb55e54c9a9bdabdc478c9a309be/proxy/pkg/informer/informer_integration_test.go | proxy/pkg/informer/informer_integration_test.go | // Copyright (c) Red Hat, Inc.
// Copyright Contributors to the Open Cluster Management project
// Licensed under the Apache License 2.0
//go:build integration
// Package informer_test contains integration tests for the informer package.
//
// These tests use the controller-runtime's envtest package to set up a real,... | go | Apache-2.0 | a116fae78ab8eb55e54c9a9bdabdc478c9a309be | 2026-01-07T09:45:49.228954Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.