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 |
|---|---|---|---|---|---|---|---|---|
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/pkg/runner/container_mock_test.go | pkg/runner/container_mock_test.go | package runner
import (
"context"
"io"
"github.com/nektos/act/pkg/common"
"github.com/nektos/act/pkg/container"
"github.com/stretchr/testify/mock"
)
type containerMock struct {
mock.Mock
container.Container
container.LinuxContainerEnvironmentExtensions
}
func (cm *containerMock) Create(capAdd []string, capD... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/pkg/runner/job_executor.go | pkg/runner/job_executor.go | package runner
import (
"context"
"fmt"
"time"
"github.com/nektos/act/pkg/common"
"github.com/nektos/act/pkg/model"
)
type jobInfo interface {
matrix() map[string]interface{}
steps() []*model.Step
startContainer() common.Executor
stopContainer() common.Executor
closeContainer() common.Executor
interpolate... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/pkg/runner/runner.go | pkg/runner/runner.go | package runner
import (
"context"
"encoding/json"
"fmt"
"os"
"runtime"
docker_container "github.com/docker/docker/api/types/container"
"github.com/nektos/act/pkg/common"
"github.com/nektos/act/pkg/model"
log "github.com/sirupsen/logrus"
)
// Runner provides capabilities to run GitHub actions
type Runner int... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/pkg/runner/step_docker.go | pkg/runner/step_docker.go | package runner
import (
"context"
"fmt"
"strings"
"github.com/kballard/go-shellquote"
"github.com/nektos/act/pkg/common"
"github.com/nektos/act/pkg/container"
"github.com/nektos/act/pkg/model"
)
type stepDocker struct {
Step *model.Step
RunContext *RunContext
env map[string]string
}
func (sd ... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/pkg/runner/expression.go | pkg/runner/expression.go | package runner
import (
"bytes"
"context"
"fmt"
"path"
"reflect"
"regexp"
"strings"
"time"
_ "embed"
"github.com/nektos/act/pkg/common"
"github.com/nektos/act/pkg/container"
"github.com/nektos/act/pkg/exprparser"
"github.com/nektos/act/pkg/model"
"gopkg.in/yaml.v3"
)
// ExpressionEvaluator is the inte... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/pkg/runner/run_context_test.go | pkg/runner/run_context_test.go | package runner
import (
"context"
"fmt"
"os"
"regexp"
"runtime"
"sort"
"strings"
"testing"
"github.com/golang-jwt/jwt/v5"
"github.com/nektos/act/pkg/exprparser"
"github.com/nektos/act/pkg/model"
log "github.com/sirupsen/logrus"
assert "github.com/stretchr/testify/assert"
yaml "gopkg.in/yaml.v3"
)
func... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/pkg/runner/action_cache_offline_mode.go | pkg/runner/action_cache_offline_mode.go | package runner
import (
"context"
"io"
"path"
git "github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing"
"github.com/nektos/act/pkg/common"
)
type GoGitActionCacheOfflineMode struct {
Parent GoGitActionCache
}
func (c GoGitActionCacheOfflineMode) Fetch(ctx context.Context, cacheDir, url, ref, t... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/pkg/runner/step_run.go | pkg/runner/step_run.go | package runner
import (
"context"
"fmt"
"runtime"
"strings"
"github.com/kballard/go-shellquote"
"github.com/nektos/act/pkg/common"
"github.com/nektos/act/pkg/container"
"github.com/nektos/act/pkg/lookpath"
"github.com/nektos/act/pkg/model"
)
type stepRun struct {
Step *model.Step
RunContext ... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/pkg/runner/step_test.go | pkg/runner/step_test.go | package runner
import (
"context"
"testing"
"github.com/nektos/act/pkg/common"
"github.com/nektos/act/pkg/model"
log "github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
yaml "gopkg.in/yaml.v3"
)
func TestMergeIntoMap(t *testing.T) {
table := []struct {
name... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/pkg/runner/step_docker_test.go | pkg/runner/step_docker_test.go | package runner
import (
"bytes"
"context"
"io"
"testing"
"github.com/nektos/act/pkg/container"
"github.com/nektos/act/pkg/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
func TestStepDockerMain(t *testing.T) {
cm := &containerMock{}
var input *container.NewContainerInput
... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/pkg/runner/step.go | pkg/runner/step.go | package runner
import (
"archive/tar"
"context"
"errors"
"fmt"
"io"
"path"
"strconv"
"strings"
"time"
"github.com/nektos/act/pkg/common"
"github.com/nektos/act/pkg/container"
"github.com/nektos/act/pkg/exprparser"
"github.com/nektos/act/pkg/model"
"github.com/sirupsen/logrus"
)
type step interface {
p... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/pkg/runner/command.go | pkg/runner/command.go | package runner
import (
"context"
"regexp"
"strings"
"github.com/nektos/act/pkg/common"
"github.com/sirupsen/logrus"
)
var commandPatternGA *regexp.Regexp
var commandPatternADO *regexp.Regexp
func init() {
commandPatternGA = regexp.MustCompile("^::([^ ]+)( (.+))?::([^\r\n]*)[\r\n]+$")
commandPatternADO = re... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/pkg/runner/logger.go | pkg/runner/logger.go | package runner
import (
"bytes"
"context"
"fmt"
"io"
"os"
"strings"
"sync"
"github.com/nektos/act/pkg/common"
"github.com/sirupsen/logrus"
"golang.org/x/term"
)
const (
// nocolor = 0
red = 31
green = 32
yellow = 33
blue = 34
magenta = 35
cyan = 36
gray = 37
)
var colors []int
var... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/pkg/runner/job_executor_test.go | pkg/runner/job_executor_test.go | package runner
import (
"context"
"fmt"
"io"
"testing"
"github.com/nektos/act/pkg/common"
"github.com/nektos/act/pkg/container"
"github.com/nektos/act/pkg/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
func TestJobExecutor(t *testing.T) {
tables := []TestJobFileInfo{
{wo... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/pkg/runner/step_action_local_test.go | pkg/runner/step_action_local_test.go | package runner
import (
"bytes"
"context"
"io"
"path/filepath"
"strings"
"testing"
"github.com/nektos/act/pkg/common"
"github.com/nektos/act/pkg/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"gopkg.in/yaml.v3"
)
type stepActionLocalMocks struct {
mock.Mock
}
func (salm *... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/pkg/runner/reusable_workflow.go | pkg/runner/reusable_workflow.go | package runner
import (
"archive/tar"
"context"
"errors"
"fmt"
"io/fs"
"os"
"path"
"regexp"
"sync"
"github.com/nektos/act/pkg/common"
"github.com/nektos/act/pkg/common/git"
"github.com/nektos/act/pkg/model"
)
func newLocalReusableWorkflowExecutor(rc *RunContext) common.Executor {
return newReusableWorkf... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/pkg/runner/step_action_remote_test.go | pkg/runner/step_action_remote_test.go | package runner
import (
"bytes"
"context"
"errors"
"io"
"strings"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"gopkg.in/yaml.v3"
"github.com/nektos/act/pkg/common"
"github.com/nektos/act/pkg/common/git"
"github.com/nektos/act/pkg/model"
)
type stepActionRemoteMocks ... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/pkg/workflowpattern/workflow_pattern.go | pkg/workflowpattern/workflow_pattern.go | package workflowpattern
import (
"fmt"
"regexp"
"strings"
)
type WorkflowPattern struct {
Pattern string
Negative bool
Regex *regexp.Regexp
}
func CompilePattern(rawpattern string) (*WorkflowPattern, error) {
negative := false
pattern := rawpattern
if strings.HasPrefix(rawpattern, "!") {
negative = tr... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/pkg/workflowpattern/trace_writer.go | pkg/workflowpattern/trace_writer.go | package workflowpattern
import "fmt"
type TraceWriter interface {
Info(string, ...interface{})
}
type EmptyTraceWriter struct{}
func (*EmptyTraceWriter) Info(string, ...interface{}) {
}
type StdOutTraceWriter struct{}
func (*StdOutTraceWriter) Info(format string, args ...interface{}) {
fmt.Printf(format+"\n", a... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/pkg/workflowpattern/workflow_pattern_test.go | pkg/workflowpattern/workflow_pattern_test.go | package workflowpattern
import (
"strings"
"testing"
"github.com/stretchr/testify/assert"
)
func TestMatchPattern(t *testing.T) {
kases := []struct {
inputs []string
patterns []string
skipResult bool
filterResult bool
}{
{
patterns: []string{"*"},
inputs: []string{"path/wit... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/pkg/schema/schema_test.go | pkg/schema/schema_test.go | package schema
import (
"testing"
"github.com/stretchr/testify/assert"
"gopkg.in/yaml.v3"
)
func TestAdditionalFunctions(t *testing.T) {
var node yaml.Node
err := yaml.Unmarshal([]byte(`
on: push
jobs:
job-with-condition:
runs-on: self-hosted
if: success() || success('joba', 'jobb') || failure() || fa... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/pkg/schema/schema.go | pkg/schema/schema.go | package schema
import (
_ "embed"
"encoding/json"
"errors"
"fmt"
"math"
"regexp"
"strconv"
"strings"
"github.com/rhysd/actionlint"
"gopkg.in/yaml.v3"
)
//go:embed workflow_schema.json
var workflowSchema string
//go:embed action_schema.json
var actionSchema string
var functions = regexp.MustCompile(`^([a-... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/pkg/exprparser/interpreter_test.go | pkg/exprparser/interpreter_test.go | package exprparser
import (
"math"
"testing"
"github.com/nektos/act/pkg/model"
"github.com/stretchr/testify/assert"
)
func TestLiterals(t *testing.T) {
table := []struct {
input string
expected interface{}
name string
}{
{"true", true, "true"},
{"false", false, "false"},
{"null", nil, "null"... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/pkg/exprparser/functions.go | pkg/exprparser/functions.go | package exprparser
import (
"crypto/sha256"
"encoding/hex"
"encoding/json"
"fmt"
"io"
"io/fs"
"os"
"path/filepath"
"reflect"
"strconv"
"strings"
"github.com/go-git/go-git/v5/plumbing/format/gitignore"
"github.com/nektos/act/pkg/model"
"github.com/rhysd/actionlint"
)
func (impl *interperterImpl) contai... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/pkg/exprparser/functions_test.go | pkg/exprparser/functions_test.go | package exprparser
import (
"path/filepath"
"testing"
"github.com/nektos/act/pkg/model"
"github.com/stretchr/testify/assert"
)
func TestFunctionContains(t *testing.T) {
table := []struct {
input string
expected interface{}
name string
}{
{"contains('search', 'item') }}", false, "contains-str-str... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/pkg/exprparser/interpreter.go | pkg/exprparser/interpreter.go | package exprparser
import (
"encoding"
"fmt"
"math"
"reflect"
"strings"
"github.com/nektos/act/pkg/model"
"github.com/rhysd/actionlint"
)
type EvaluationEnvironment struct {
Github *model.GithubContext
Env map[string]string
Job *model.JobContext
Jobs *map[string]*model.WorkflowCallResu... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/cmd/root.go | cmd/root.go | package cmd
import (
"bufio"
"bytes"
"context"
"encoding/json"
"fmt"
"os"
"path/filepath"
"regexp"
"runtime"
"runtime/debug"
"strings"
"github.com/AlecAivazis/survey/v2"
"github.com/adrg/xdg"
"github.com/andreaskoch/go-fswatch"
docker_container "github.com/docker/docker/api/types/container"
"github.co... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | true |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/cmd/root_test.go | cmd/root_test.go | package cmd
import (
"context"
"path"
"testing"
"github.com/stretchr/testify/assert"
)
func TestReadSecrets(t *testing.T) {
secrets := map[string]string{}
ret := readEnvsEx(path.Join("testdata", "secrets.yml"), secrets, true)
assert.True(t, ret)
assert.Equal(t, `line1
line2
line3
`, secrets["MYSECRET"])
}
f... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/cmd/secrets.go | cmd/secrets.go | package cmd
import (
"fmt"
"os"
"strings"
log "github.com/sirupsen/logrus"
"golang.org/x/term"
)
type secrets map[string]string
func newSecrets(secretList []string) secrets {
s := make(map[string]string)
for _, secretPair := range secretList {
secretPairParts := strings.SplitN(secretPair, "=", 2)
secretP... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/cmd/list.go | cmd/list.go | package cmd
import (
"fmt"
"strconv"
"strings"
"github.com/nektos/act/pkg/model"
)
func printList(plan *model.Plan) error {
type lineInfoDef struct {
jobID string
jobName string
stage string
wfName string
wfFile string
events string
}
lineInfos := []lineInfoDef{}
header := lineInfoDef{
... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/cmd/platforms.go | cmd/platforms.go | package cmd
import (
"strings"
)
func (i *Input) newPlatforms() map[string]string {
platforms := map[string]string{
"ubuntu-latest": "node:16-buster-slim",
"ubuntu-22.04": "node:16-bullseye-slim",
"ubuntu-20.04": "node:16-buster-slim",
"ubuntu-18.04": "node:16-buster-slim",
}
for _, p := range i.platf... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/cmd/notices.go | cmd/notices.go | package cmd
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
"os"
"path/filepath"
"runtime"
"strings"
"time"
log "github.com/sirupsen/logrus"
)
type Notice struct {
Level string `json:"level"`
Message string `json:"message"`
}
func displayNotices(input *Input) {
// Avoid causing trouble parsing th... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/cmd/input.go | cmd/input.go | package cmd
import (
"path/filepath"
log "github.com/sirupsen/logrus"
)
// Input contains the input for the root command
type Input struct {
actor string
workdir string
workflowsPath string
autodetectEvent bool
eve... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/cmd/execute_test.go | cmd/execute_test.go | package cmd
import (
"context"
"os"
"testing"
)
// Helper function to test main with different os.Args
func testMain(args []string) (exitCode int) {
// Save original os.Args and defer restoring it
origArgs := os.Args
defer func() { os.Args = origArgs }()
// Save original os.Exit and defer restoring it
defer ... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/cmd/graph.go | cmd/graph.go | package cmd
import (
"os"
"github.com/nektos/act/pkg/common"
"github.com/nektos/act/pkg/model"
)
func drawGraph(plan *model.Plan) error {
drawings := make([]*common.Drawing, 0)
jobPen := common.NewPen(common.StyleSingleLine, 96)
arrowPen := common.NewPen(common.StyleNoLine, 97)
for i, stage := range plan.Sta... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
nektos/act | https://github.com/nektos/act/blob/d93106d194bba273d70d2ba604ea633c3f396b59/cmd/dir.go | cmd/dir.go | package cmd
import (
"os"
"path/filepath"
log "github.com/sirupsen/logrus"
)
var (
UserHomeDir string
CacheHomeDir string
)
func init() {
home, err := os.UserHomeDir()
if err != nil {
log.Fatal(err)
}
UserHomeDir = home
if v := os.Getenv("XDG_CACHE_HOME"); v != "" {
CacheHomeDir = v
} else {
Cach... | go | MIT | d93106d194bba273d70d2ba604ea633c3f396b59 | 2026-01-07T08:35:43.481138Z | false |
avelino/awesome-go | https://github.com/avelino/awesome-go/blob/6baf3277ae0ab60edf402a6f17ab81bd3db44666/stale_repositories_test.go | stale_repositories_test.go | package main
import (
"bytes"
"context"
"encoding/json"
"fmt"
"log"
"net/http"
"os"
"regexp"
"strings"
"testing"
"text/template"
"time"
"github.com/PuerkitoBio/goquery"
"golang.org/x/oauth2"
)
const issueTemplateContent = `
{{range .}}
- [ ] {{.}}
{{end}}
`
var issueTemplate = template.Must(template.N... | go | MIT | 6baf3277ae0ab60edf402a6f17ab81bd3db44666 | 2026-01-07T08:35:43.239289Z | false |
avelino/awesome-go | https://github.com/avelino/awesome-go/blob/6baf3277ae0ab60edf402a6f17ab81bd3db44666/main_test.go | main_test.go | package main
import (
"bytes"
"github.com/avelino/awesome-go/pkg/markdown"
"os"
"regexp"
"sort"
"strings"
"testing"
"github.com/PuerkitoBio/goquery"
)
var (
reContainsLink = regexp.MustCompile(`\* \[.*\]\(.*\)`)
reOnlyLink = regexp.MustCompile(`\* \[.*\]\([^()]*\)$`)
reLinkWithDescriptio... | go | MIT | 6baf3277ae0ab60edf402a6f17ab81bd3db44666 | 2026-01-07T08:35:43.239289Z | false |
avelino/awesome-go | https://github.com/avelino/awesome-go/blob/6baf3277ae0ab60edf402a6f17ab81bd3db44666/maturity_test.go | maturity_test.go | package main
import (
"encoding/json"
"fmt"
"net/http"
"os"
"strings"
"testing"
"time"
"github.com/PuerkitoBio/goquery"
)
var (
githubApiAuthorizationToken = os.Getenv("GITHUB_API_TOKEN")
minimumMaturityDate = time.Now().AddDate(0, -5, 0)
)
func TestMaturity(t *testing.T) {
doc := goqueryFromRead... | go | MIT | 6baf3277ae0ab60edf402a6f17ab81bd3db44666 | 2026-01-07T08:35:43.239289Z | false |
avelino/awesome-go | https://github.com/avelino/awesome-go/blob/6baf3277ae0ab60edf402a6f17ab81bd3db44666/main.go | main.go | // Package main contains code for generate static site.
package main
import (
"bytes"
"embed"
"errors"
"fmt"
template2 "html/template"
"net/url"
"os"
"path/filepath"
"text/template"
"github.com/avelino/awesome-go/pkg/markdown"
cp "github.com/otiai10/copy"
"github.com/PuerkitoBio/goquery"
"github.com/ave... | go | MIT | 6baf3277ae0ab60edf402a6f17ab81bd3db44666 | 2026-01-07T08:35:43.239289Z | false |
avelino/awesome-go | https://github.com/avelino/awesome-go/blob/6baf3277ae0ab60edf402a6f17ab81bd3db44666/pkg/slug/generator.go | pkg/slug/generator.go | package slug
import (
"strings"
"github.com/avelino/slugify"
)
// Generate slugs similar to GitHub's slugs on markdown parsing
func Generate(text string) string {
// FIXME: this is should be like regexp.Replace(`[^-a-zA-Z\d]+`, ``)
s := strings.ReplaceAll(text, "/", "")
return slugify.Slugify(strings.TrimSpace(... | go | MIT | 6baf3277ae0ab60edf402a6f17ab81bd3db44666 | 2026-01-07T08:35:43.239289Z | false |
avelino/awesome-go | https://github.com/avelino/awesome-go/blob/6baf3277ae0ab60edf402a6f17ab81bd3db44666/pkg/slug/generator_test.go | pkg/slug/generator_test.go | package slug
import "testing"
func TestGenerate(t *testing.T) {
tests := []struct {
name string
input string
expected string
}{
{
name: "with spaces",
input: "some string with spaces",
expected: "some-string-with-spaces",
},
{
name: "with out any non-literal chars",
inpu... | go | MIT | 6baf3277ae0ab60edf402a6f17ab81bd3db44666 | 2026-01-07T08:35:43.239289Z | false |
avelino/awesome-go | https://github.com/avelino/awesome-go/blob/6baf3277ae0ab60edf402a6f17ab81bd3db44666/pkg/markdown/convert_test.go | pkg/markdown/convert_test.go | package markdown
import (
"strings"
"testing"
)
func TestToHTML(t *testing.T) {
input := []byte(
`## some headline
followed by some paragraph with [a link](https://example.local)
and some list:
- first
- second
- nested on second level
- nested on third level
- ~~strikethrough~~
- yet another second level ... | go | MIT | 6baf3277ae0ab60edf402a6f17ab81bd3db44666 | 2026-01-07T08:35:43.239289Z | false |
avelino/awesome-go | https://github.com/avelino/awesome-go/blob/6baf3277ae0ab60edf402a6f17ab81bd3db44666/pkg/markdown/convert.go | pkg/markdown/convert.go | package markdown
import (
"bytes"
"github.com/avelino/awesome-go/pkg/slug"
"github.com/yuin/goldmark"
"github.com/yuin/goldmark/ast"
"github.com/yuin/goldmark/extension"
"github.com/yuin/goldmark/parser"
"github.com/yuin/goldmark/renderer/html"
"github.com/yuin/goldmark/util"
)
// ToHTML converts markdown by... | go | MIT | 6baf3277ae0ab60edf402a6f17ab81bd3db44666 | 2026-01-07T08:35:43.239289Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/main.go | main.go | package main
import (
_ "embed"
"fmt"
"os"
"os/exec"
"strings"
fzf "github.com/junegunn/fzf/src"
"github.com/junegunn/fzf/src/protector"
)
var version = "0.67"
var revision = "devel"
//go:embed shell/key-bindings.bash
var bashKeyBindings []byte
//go:embed shell/completion.bash
var bashCompletion []byte
//g... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/options_no_pprof.go | src/options_no_pprof.go | //go:build !pprof
// +build !pprof
package fzf
import "errors"
func (o *Options) initProfiling() error {
if o.CPUProfile != "" || o.MEMProfile != "" || o.BlockProfile != "" || o.MutexProfile != "" {
return errors.New("error: profiling not supported: FZF must be built with '-tags=pprof' to enable profiling")
}
r... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/merger_test.go | src/merger_test.go | package fzf
import (
"fmt"
"math/rand"
"sort"
"testing"
"github.com/junegunn/fzf/src/util"
)
func assert(t *testing.T, cond bool, msg ...string) {
if !cond {
t.Error(msg)
}
}
func randResult() Result {
str := fmt.Sprintf("%d", rand.Uint32())
chars := util.ToChars([]byte(str))
chars.Index = rand.Int31()
... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/terminal_unix.go | src/terminal_unix.go | //go:build !windows
package fzf
import (
"os"
"os/signal"
"syscall"
"golang.org/x/sys/unix"
)
func notifyOnResize(resizeChan chan<- os.Signal) {
signal.Notify(resizeChan, syscall.SIGWINCH)
}
func notifyStop(p *os.Process) {
pid := p.Pid
pgid, err := unix.Getpgid(pid)
if err == nil {
pid = pgid * -1
}
u... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/history_test.go | src/history_test.go | package fzf
import (
"os"
"runtime"
"testing"
)
func TestHistory(t *testing.T) {
maxHistory := 50
// Invalid arguments
var paths []string
if runtime.GOOS == "windows" {
// GOPATH should exist, so we shouldn't be able to override it
paths = []string{os.Getenv("GOPATH")}
} else {
paths = []string{"/etc",... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/terminal_windows.go | src/terminal_windows.go | //go:build windows
package fzf
import (
"os"
)
func notifyOnResize(resizeChan chan<- os.Signal) {
// TODO
}
func notifyStop(p *os.Process) {
// NOOP
}
| go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/winpty.go | src/winpty.go | //go:build !windows
package fzf
import "errors"
func needWinpty(_ *Options) bool {
return false
}
func runWinpty(_ []string, _ *Options) (int, error) {
return ExitError, errors.New("Not supported")
}
| go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/proxy.go | src/proxy.go | package fzf
import (
"bufio"
"errors"
"fmt"
"io"
"os"
"os/exec"
"os/signal"
"path/filepath"
"regexp"
"strings"
"time"
"github.com/junegunn/fzf/src/tui"
"github.com/junegunn/fzf/src/util"
)
const becomeSuffix = ".become"
func escapeSingleQuote(str string) string {
return "'" + strings.ReplaceAll(str, "... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/actiontype_string.go | src/actiontype_string.go | // Code generated by "stringer -type=actionType"; DO NOT EDIT.
package fzf
import "strconv"
func _() {
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
var x [1]struct{}
_ = x[actIgnore-0]
_ = x[actStart-1]
_ = x[... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/constants.go | src/constants.go | package fzf
import (
"math"
"time"
"github.com/junegunn/fzf/src/util"
)
const (
// Core
coordinatorDelayMax time.Duration = 100 * time.Millisecond
coordinatorDelayStep time.Duration = 10 * time.Millisecond
// Reader
readerBufferSize = 64 * 1024
readerSlabSize = 128 * 1024
readerPollInterval... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/chunklist.go | src/chunklist.go | package fzf
import "sync"
// Chunk is a list of Items whose size has the upper limit of chunkSize
type Chunk struct {
items [chunkSize]Item
count int
}
// ItemBuilder is a closure type that builds Item object from byte array
type ItemBuilder func(*Item, []byte) bool
// ChunkList is a list of Chunks
type ChunkList... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/tokenizer.go | src/tokenizer.go | package fzf
import (
"bytes"
"fmt"
"regexp"
"strconv"
"strings"
"unicode"
"github.com/junegunn/fzf/src/util"
)
const rangeEllipsis = 0
// Range represents nth-expression
type Range struct {
begin int
end int
}
func (r Range) IsFull() bool {
return r.begin == rangeEllipsis && r.end == rangeEllipsis
}
f... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/item_test.go | src/item_test.go | package fzf
import (
"testing"
"github.com/junegunn/fzf/src/util"
)
func TestStringPtr(t *testing.T) {
orig := []byte("\x1b[34mfoo")
text := []byte("\x1b[34mbar")
item := Item{origText: &orig, text: util.ToChars(text)}
if item.AsString(true) != "foo" || item.AsString(false) != string(orig) {
t.Fail()
}
if ... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/result.go | src/result.go | package fzf
import (
"math"
"sort"
"unicode"
"github.com/junegunn/fzf/src/tui"
"github.com/junegunn/fzf/src/util"
)
// Offset holds two 32-bit integers denoting the offsets of a matched substring
type Offset [2]int32
type colorOffset struct {
offset [2]int32
color tui.ColorPair
match bool
url *url
}
... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/cache.go | src/cache.go | package fzf
import "sync"
// queryCache associates strings to lists of items
type queryCache map[string][]Result
// ChunkCache associates Chunk and query string to lists of items
type ChunkCache struct {
mutex sync.Mutex
cache map[*Chunk]*queryCache
}
// NewChunkCache returns a new ChunkCache
func NewChunkCache()... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/cache_test.go | src/cache_test.go | package fzf
import "testing"
func TestChunkCache(t *testing.T) {
cache := NewChunkCache()
chunk1p := &Chunk{}
chunk2p := &Chunk{count: chunkSize}
items1 := []Result{{}}
items2 := []Result{{}, {}}
cache.Add(chunk1p, "foo", items1)
cache.Add(chunk2p, "foo", items1)
cache.Add(chunk2p, "bar", items2)
{ // chunk... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/result_test.go | src/result_test.go | package fzf
import (
"math"
"sort"
"testing"
"github.com/junegunn/fzf/src/tui"
"github.com/junegunn/fzf/src/util"
)
func withIndex(i *Item, index int) *Item {
(*i).text.Index = int32(index)
return i
}
func TestOffsetSort(t *testing.T) {
offsets := []Offset{
{3, 5}, {2, 7},
{1, 3}, {2, 9}}
sort.Sort(ByO... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/pattern.go | src/pattern.go | package fzf
import (
"fmt"
"regexp"
"strings"
"github.com/junegunn/fzf/src/algo"
"github.com/junegunn/fzf/src/util"
)
// fuzzy
// 'exact
// ^prefix-exact
// suffix-exact$
// !inverse-exact
// !'inverse-fuzzy
// !^inverse-prefix-exact
// !inverse-suffix-exact$
type termType int
const (
termFuzzy termType = io... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/reader.go | src/reader.go | package fzf
import (
"bytes"
"context"
"io"
"io/fs"
"os"
"path/filepath"
"slices"
"strings"
"sync"
"sync/atomic"
"time"
"github.com/charlievieth/fastwalk"
"github.com/junegunn/fzf/src/util"
)
// Reader reads from command or standard input
type Reader struct {
pusher func([]byte) bool
executor *util.... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/terminal.go | src/terminal.go | package fzf
import (
"bufio"
"context"
"encoding/json"
"fmt"
"io"
"maps"
"math"
"net"
"os"
"os/exec"
"os/signal"
"regexp"
"sort"
"strconv"
"strings"
"sync"
"sync/atomic"
"syscall"
"time"
"unicode"
"github.com/rivo/uniseg"
"github.com/junegunn/fzf/src/tui"
"github.com/junegunn/fzf/src/util"
)
... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | true |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/options_pprof_test.go | src/options_pprof_test.go | //go:build pprof
// +build pprof
package fzf
import (
"bytes"
"flag"
"os"
"os/exec"
"path/filepath"
"testing"
"github.com/junegunn/fzf/src/util"
)
// runInitProfileTests is an internal flag used TestInitProfiling
var runInitProfileTests = flag.Bool("test-init-profile", false, "run init profile tests")
func ... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/winpty_windows.go | src/winpty_windows.go | //go:build windows
package fzf
import (
"fmt"
"os"
"os/exec"
"strings"
"github.com/junegunn/fzf/src/util"
)
func isMintty345() bool {
return util.CompareVersions(os.Getenv("TERM_PROGRAM_VERSION"), "3.4.5") >= 0
}
func needWinpty(opts *Options) bool {
if os.Getenv("TERM_PROGRAM") != "mintty" {
return false... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/merger.go | src/merger.go | package fzf
import "fmt"
// EmptyMerger is a Merger with no data
func EmptyMerger(revision revision) *Merger {
return NewMerger(nil, [][]Result{}, false, false, revision, 0, 0)
}
// Merger holds a set of locally sorted lists of items and provides the view of
// a single, globally-sorted list
type Merger struct {
p... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/reader_test.go | src/reader_test.go | package fzf
import (
"testing"
"time"
"github.com/junegunn/fzf/src/util"
)
func TestReadFromCommand(t *testing.T) {
strs := []string{}
eb := util.NewEventBox()
exec := util.NewExecutor("")
reader := NewReader(
func(s []byte) bool { strs = append(strs, string(s)); return true },
eb, exec, false, true)
re... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/terminal_test.go | src/terminal_test.go | package fzf
import (
"bytes"
"io"
"os"
"regexp"
"strings"
"testing"
"text/template"
"github.com/junegunn/fzf/src/util"
)
func replacePlaceholderTest(template string, stripAnsi bool, delimiter Delimiter, printsep string, forcePlus bool, query string, allItems [3][]*Item) string {
replaced, _ := replacePlaceh... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/options_pprof.go | src/options_pprof.go | //go:build pprof
// +build pprof
package fzf
import (
"fmt"
"os"
"runtime"
"runtime/pprof"
"github.com/junegunn/fzf/src/util"
)
func (o *Options) initProfiling() error {
if o.CPUProfile != "" {
f, err := os.Create(o.CPUProfile)
if err != nil {
return fmt.Errorf("could not create CPU profile: %w", err)
... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/history.go | src/history.go | package fzf
import (
"errors"
"os"
"strings"
)
// History struct represents input history
type History struct {
path string
lines []string
modified map[int]string
maxSize int
cursor int
}
// NewHistory returns the pointer to a new History struct
func NewHistory(path string, maxSize int) (*History, ... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/chunklist_test.go | src/chunklist_test.go | package fzf
import (
"fmt"
"testing"
"github.com/junegunn/fzf/src/util"
)
func TestChunkList(t *testing.T) {
// FIXME global
sortCriteria = []criterion{byScore, byLength}
cl := NewChunkList(NewChunkCache(), func(item *Item, s []byte) bool {
item.text = util.ToChars(s)
return true
})
// Snapshot
snapsh... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/result_x86.go | src/result_x86.go | //go:build 386 || amd64
package fzf
import "unsafe"
func compareRanks(irank Result, jrank Result, tac bool) bool {
left := *(*uint64)(unsafe.Pointer(&irank.points[0]))
right := *(*uint64)(unsafe.Pointer(&jrank.points[0]))
if left < right {
return true
} else if left > right {
return false
}
return (irank.i... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/tokenizer_test.go | src/tokenizer_test.go | package fzf
import (
"testing"
)
func TestParseRange(t *testing.T) {
{
i := ".."
r, _ := ParseRange(&i)
if r.begin != rangeEllipsis || r.end != rangeEllipsis {
t.Errorf("%v", r)
}
}
{
i := "3.."
r, _ := ParseRange(&i)
if r.begin != 3 || r.end != rangeEllipsis {
t.Errorf("%v", r)
}
}
{
i ... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/server.go | src/server.go | package fzf
import (
"bufio"
"bytes"
"crypto/subtle"
"errors"
"fmt"
"net"
"os"
"regexp"
"strconv"
"strings"
"time"
)
var getRegex *regexp.Regexp
func init() {
getRegex = regexp.MustCompile(`^GET /(?:\?([a-z0-9=&]+))? HTTP`)
}
type getParams struct {
limit int
offset int
}
const (
crlf =... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/result_others.go | src/result_others.go | //go:build !386 && !amd64
package fzf
func compareRanks(irank Result, jrank Result, tac bool) bool {
for idx := 3; idx >= 0; idx-- {
left := irank.points[idx]
right := jrank.points[idx]
if left < right {
return true
} else if left > right {
return false
}
}
return (irank.item.Index() <= jrank.item.... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/options_test.go | src/options_test.go | package fzf
import (
"fmt"
"os"
"testing"
"github.com/junegunn/fzf/src/tui"
)
func TestDelimiterRegex(t *testing.T) {
// Valid regex, but a single character -> string
delim := delimiterRegexp(".")
if delim.regex != nil || *delim.str != "." {
t.Error(delim)
}
delim = delimiterRegexp("|")
if delim.regex !=... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/tmux.go | src/tmux.go | package fzf
import (
"os"
"os/exec"
"github.com/junegunn/fzf/src/tui"
)
func runTmux(args []string, opts *Options) (int, error) {
// Prepare arguments
fzf, rest := args[0], args[1:]
args = []string{"--bind=ctrl-z:ignore"}
if !opts.Tmux.border && (opts.BorderShape == tui.BorderUndefined || opts.BorderShape == ... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/options.go | src/options.go | package fzf
import (
"errors"
"fmt"
"maps"
"os"
"regexp"
"strconv"
"strings"
"unicode"
"github.com/junegunn/fzf/src/algo"
"github.com/junegunn/fzf/src/tui"
"github.com/junegunn/fzf/src/util"
"github.com/junegunn/go-shellwords"
"github.com/rivo/uniseg"
)
const Usage = `fzf is an interactive filter progr... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | true |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/ansi_test.go | src/ansi_test.go | package fzf
import (
"math/rand"
"regexp"
"strings"
"testing"
"unicode/utf8"
"github.com/junegunn/fzf/src/tui"
)
// The following regular expression will include not all but most of the
// frequently used ANSI sequences. This regex is used as a reference for
// testing nextAnsiEscapeSequence().
//
// Reference... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/functions.go | src/functions.go | package fzf
import (
"os"
"strings"
"unsafe"
)
func WriteTemporaryFile(data []string, printSep string) string {
f, err := os.CreateTemp("", "fzf-temp-*")
if err != nil {
// Unable to create temporary file
// FIXME: Should we terminate the program?
return ""
}
defer f.Close()
f.WriteString(strings.Join(... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/core.go | src/core.go | // Package fzf implements fzf, a command-line fuzzy finder.
package fzf
import (
"maps"
"os"
"sync"
"time"
"github.com/junegunn/fzf/src/tui"
"github.com/junegunn/fzf/src/util"
)
/*
Reader -> EvtReadFin
Reader -> EvtReadNew -> Matcher (restart)
Terminal -> EvtSearchNew:bool -> Matcher (restart)
Mat... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/pattern_test.go | src/pattern_test.go | package fzf
import (
"reflect"
"testing"
"github.com/junegunn/fzf/src/algo"
"github.com/junegunn/fzf/src/util"
)
var slab *util.Slab
func init() {
slab = util.MakeSlab(slab16Size, slab32Size)
}
func TestParseTermsExtended(t *testing.T) {
terms := parseTerms(true, CaseSmart, false,
"aaa 'bbb ^ccc ddd$ !eee ... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/matcher.go | src/matcher.go | package fzf
import (
"fmt"
"runtime"
"sort"
"sync"
"time"
"github.com/junegunn/fzf/src/util"
)
// MatchRequest represents a search request
type MatchRequest struct {
chunks []*Chunk
pattern *Pattern
final bool
sort bool
revision revision
}
type MatchResult struct {
merger *Merger
passMerg... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/ansi.go | src/ansi.go | package fzf
import (
"fmt"
"strconv"
"strings"
"unicode/utf8"
"github.com/junegunn/fzf/src/tui"
)
type ansiOffset struct {
offset [2]int32
color ansiState
}
type url struct {
uri string
params string
}
type ansiState struct {
fg tui.Color
bg tui.Color
attr tui.Attr
lbg tui.Color
url *url
}
... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/item.go | src/item.go | package fzf
import (
"math"
"github.com/junegunn/fzf/src/util"
)
type transformed struct {
// Because nth can be changed dynamically by change-nth action, we need to
// keep the revision number at the time of transformation.
revision revision
tokens []Token
}
// Item represents each input line. 56 bytes.
ty... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/proxy_windows.go | src/proxy_windows.go | //go:build windows
package fzf
import (
"fmt"
"io"
"os/exec"
"strconv"
"strings"
"sync/atomic"
)
var shPath atomic.Value
func sh(bash bool) (string, error) {
if cached := shPath.Load(); cached != nil {
return cached.(string), nil
}
name := "sh"
if bash {
name = "bash"
}
cmd := exec.Command("cygpath... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/proxy_unix.go | src/proxy_unix.go | //go:build !windows
package fzf
import (
"io"
"os"
"golang.org/x/sys/unix"
)
func sh(bash bool) (string, error) {
if bash {
return "bash", nil
}
return "sh", nil
}
func mkfifo(path string, mode uint32) (string, error) {
return path, unix.Mkfifo(path, mode)
}
func withOutputPipe(output string, task func(i... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/util/atexit_test.go | src/util/atexit_test.go | package util
import (
"reflect"
"testing"
)
func TestAtExit(t *testing.T) {
want := []int{3, 2, 1, 0}
var called []int
for i := range 4 {
n := i
AtExit(func() { called = append(called, n) })
}
RunAtExitFuncs()
if !reflect.DeepEqual(called, want) {
t.Errorf("AtExit: want call order: %v got: %v", want, ca... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/util/eventbox.go | src/util/eventbox.go | package util
import "sync"
// EventType is the type for fzf events
type EventType int
// Events is a type that associates EventType to any data
type Events map[EventType]any
// EventBox is used for coordinating events
type EventBox struct {
events Events
cond *sync.Cond
ignore map[EventType]bool
}
// NewEvent... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/util/atomicbool_test.go | src/util/atomicbool_test.go | package util
import "testing"
func TestAtomicBool(t *testing.T) {
if !NewAtomicBool(true).Get() || NewAtomicBool(false).Get() {
t.Error("Invalid initial value")
}
ab := NewAtomicBool(true)
if ab.Set(false) {
t.Error("Invalid return value")
}
if ab.Get() {
t.Error("Invalid state")
}
}
| go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/util/atexit.go | src/util/atexit.go | package util
import (
"sync"
)
var atExitFuncs []func()
// AtExit registers the function fn to be called on program termination.
// The functions will be called in reverse order they were registered.
func AtExit(fn func()) {
if fn == nil {
panic("AtExit called with nil func")
}
once := &sync.Once{}
atExitFunc... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/util/util_unix.go | src/util/util_unix.go | //go:build !windows
package util
import (
"fmt"
"os"
"os/exec"
"strings"
"syscall"
"golang.org/x/sys/unix"
)
type Executor struct {
shell string
args []string
escaper *strings.Replacer
}
func NewExecutor(withShell string) *Executor {
shell := os.Getenv("SHELL")
args := strings.Fields(withShell)
if... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/util/util.go | src/util/util.go | package util
import (
"cmp"
"math"
"os"
"strconv"
"strings"
"github.com/mattn/go-isatty"
"github.com/rivo/uniseg"
)
// StringWidth returns string width where each CR/LF character takes 1 column
func StringWidth(s string) int {
return uniseg.StringWidth(s) + strings.Count(s, "\n") + strings.Count(s, "\r")
}
... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/util/util_windows.go | src/util/util_windows.go | //go:build windows
package util
import (
"fmt"
"os"
"os/exec"
"path/filepath"
"regexp"
"strings"
"sync/atomic"
"syscall"
)
type shellType int
const (
shellTypeUnknown shellType = iota
shellTypeCmd
shellTypePowerShell
)
var escapeRegex = regexp.MustCompile(`[&|<>()^%!"]`)
type Executor struct {
shell ... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/util/concurrent_set.go | src/util/concurrent_set.go | package util
import "sync"
// ConcurrentSet is a thread-safe set implementation.
type ConcurrentSet[T comparable] struct {
lock sync.RWMutex
items map[T]struct{}
}
// NewConcurrentSet creates a new ConcurrentSet.
func NewConcurrentSet[T comparable]() *ConcurrentSet[T] {
return &ConcurrentSet[T]{
items: make(ma... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/util/eventbox_test.go | src/util/eventbox_test.go | package util
import "testing"
// fzf events
const (
EvtReadNew EventType = iota
EvtReadFin
EvtSearchNew
EvtSearchProgress
EvtSearchFin
)
func TestEventBox(t *testing.T) {
eb := NewEventBox()
// Wait should return immediately
ch := make(chan bool)
go func() {
eb.Set(EvtReadNew, 10)
ch <- true
<-ch
... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/util/chars_test.go | src/util/chars_test.go | package util
import (
"fmt"
"testing"
)
func TestToCharsAscii(t *testing.T) {
chars := ToChars([]byte("foobar"))
if !chars.inBytes || chars.ToString() != "foobar" || !chars.inBytes {
t.Error()
}
}
func TestCharsLength(t *testing.T) {
chars := ToChars([]byte("\tabc한글 "))
if chars.inBytes || chars.Length() !... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/util/chars.go | src/util/chars.go | package util
import (
"bytes"
"fmt"
"unicode"
"unicode/utf8"
"unsafe"
)
const (
overflow64 uint64 = 0x8080808080808080
overflow32 uint32 = 0x80808080
)
type Chars struct {
slice []byte // or []rune
inBytes bool
trimLengthKnown bool
trimLength uint16
// XXX Piggybacking item index ... | go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
junegunn/fzf | https://github.com/junegunn/fzf/blob/3c7cbc9d476025e0cf90e2303bce38935898df1f/src/util/slab.go | src/util/slab.go | package util
type Slab struct {
I16 []int16
I32 []int32
}
func MakeSlab(size16 int, size32 int) *Slab {
return &Slab{
I16: make([]int16, size16),
I32: make([]int32, size32)}
}
| go | MIT | 3c7cbc9d476025e0cf90e2303bce38935898df1f | 2026-01-07T08:35:43.431645Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.