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 |
|---|---|---|---|---|---|---|---|---|
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/third-party/github.com/letsencrypt/boulder/ra/proto/ra.pb.go | third-party/github.com/letsencrypt/boulder/ra/proto/ra.pb.go | // Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.5
// protoc v3.20.1
// source: ra.proto
package proto
import (
proto1 "github.com/letsencrypt/boulder/ca/proto"
proto "github.com/letsencrypt/boulder/core/proto"
protoreflect "google.golang.org/protobuf/reflect/protorefle... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | true |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/third-party/github.com/letsencrypt/boulder/policy/pa_test.go | third-party/github.com/letsencrypt/boulder/policy/pa_test.go | package policy
import (
"fmt"
"net/netip"
"os"
"strings"
"testing"
"gopkg.in/yaml.v3"
"github.com/letsencrypt/boulder/core"
berrors "github.com/letsencrypt/boulder/errors"
"github.com/letsencrypt/boulder/features"
"github.com/letsencrypt/boulder/identifier"
blog "github.com/letsencrypt/boulder/log"
"gith... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/third-party/github.com/letsencrypt/boulder/policy/pa.go | third-party/github.com/letsencrypt/boulder/policy/pa.go | package policy
import (
"crypto/sha256"
"encoding/hex"
"errors"
"fmt"
"net/mail"
"net/netip"
"os"
"regexp"
"slices"
"strings"
"sync"
"golang.org/x/net/idna"
"golang.org/x/text/unicode/norm"
"github.com/letsencrypt/boulder/core"
berrors "github.com/letsencrypt/boulder/errors"
"github.com/letsencrypt/b... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/gh/projects.go | internal/gh/projects.go | package gh
// ProjectsV1Support provides type safety and readability around whether or not Projects v1 is supported
// by the targeted host.
//
// It is a sealed type to ensure that consumers must use the exported ProjectsV1Supported and ProjectsV1Unsupported
// variables to get an instance of the type.
type ProjectsV... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/gh/gh.go | internal/gh/gh.go | // Package gh provides types that represent the domain of the CLI application.
//
// For example, the CLI expects to be able to get and set user configuration in order to perform its functionality,
// so the Config interface is defined here, though the concrete implementation lives elsewhere. Though the current
// impl... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/gh/mock/config.go | internal/gh/mock/config.go | // Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package ghmock
import (
"github.com/cli/cli/v2/internal/gh"
o "github.com/cli/cli/v2/pkg/option"
"sync"
)
// Ensure, that ConfigMock does implement gh.Config.
// If this is not the case, regenerate this file with moq.
var _ gh.Config = &ConfigMock{}... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/gh/mock/migration.go | internal/gh/mock/migration.go | // Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package ghmock
import (
"github.com/cli/cli/v2/internal/gh"
ghConfig "github.com/cli/go-gh/v2/pkg/config"
"sync"
)
// Ensure, that MigrationMock does implement gh.Migration.
// If this is not the case, regenerate this file with moq.
var _ gh.Migrati... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/safepaths/absolute_test.go | internal/safepaths/absolute_test.go | package safepaths_test
import (
"fmt"
"os"
"path/filepath"
"runtime"
"testing"
"github.com/cli/cli/v2/internal/safepaths"
"github.com/stretchr/testify/require"
)
func TestParseAbsolutePath(t *testing.T) {
t.Parallel()
absolutePath, err := safepaths.ParseAbsolute("/base")
require.NoError(t, err)
require.... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/safepaths/absolute.go | internal/safepaths/absolute.go | package safepaths
import (
"fmt"
"path/filepath"
"strings"
)
// Absolute must be constructed via ParseAbsolute, or other methods in this package.
// The zero value of Absolute will panic when String is called.
type Absolute struct {
path string
}
// ParseAbsolute takes a string path that may be relative and retu... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/ghcmd/update_disabled.go | internal/ghcmd/update_disabled.go | //go:build !updateable
package ghcmd
// See update_enabled.go comment for more information.
var updaterEnabled = ""
| go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/ghcmd/cmd_test.go | internal/ghcmd/cmd_test.go | package ghcmd
import (
"bytes"
"errors"
"fmt"
"net"
"testing"
"github.com/cli/cli/v2/pkg/cmdutil"
"github.com/spf13/cobra"
)
func Test_printError(t *testing.T) {
cmd := &cobra.Command{}
type args struct {
err error
cmd *cobra.Command
debug bool
}
tests := []struct {
name string
args a... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/ghcmd/update_enabled.go | internal/ghcmd/update_enabled.go | //go:build updateable
package ghcmd
// `updateable` is a build tag set in the gh formula within homebrew/homebrew-core
// and is used to control whether users are notified of newer GitHub CLI releases.
//
// Currently, updaterEnabled needs to be set to 'cli/cli' as it affects where
// update.CheckForUpdate() checks f... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/ghcmd/cmd.go | internal/ghcmd/cmd.go | package ghcmd
import (
"context"
"errors"
"fmt"
"io"
"net"
"os"
"os/exec"
"path/filepath"
"strings"
"time"
surveyCore "github.com/AlecAivazis/survey/v2/core"
"github.com/AlecAivazis/survey/v2/terminal"
"github.com/cli/cli/v2/api"
"github.com/cli/cli/v2/internal/build"
"github.com/cli/cli/v2/internal/co... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/tableprinter/table_printer_test.go | internal/tableprinter/table_printer_test.go | package tableprinter_test
import (
"testing"
"github.com/cli/cli/v2/internal/tableprinter"
"github.com/cli/cli/v2/pkg/iostreams"
"github.com/stretchr/testify/require"
)
func TestHeadersAreNotMutated(t *testing.T) {
// Given a TTY environment so that headers are included in the table
ios, _, _, _ := iostreams.T... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/tableprinter/table_printer.go | internal/tableprinter/table_printer.go | package tableprinter
import (
"io"
"strings"
"time"
"github.com/cli/cli/v2/internal/text"
"github.com/cli/cli/v2/pkg/iostreams"
"github.com/cli/go-gh/v2/pkg/tableprinter"
)
type TablePrinter struct {
tableprinter.TablePrinter
isTTY bool
cs *iostreams.ColorScheme
}
// IsTTY gets whether the TablePrinter ... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/keyring/keyring.go | internal/keyring/keyring.go | // Package keyring is a simple wrapper that adds timeouts to the zalando/go-keyring package.
package keyring
import (
"errors"
"time"
"github.com/zalando/go-keyring"
)
var ErrNotFound = errors.New("secret not found in keyring")
type TimeoutError struct {
message string
}
func (e *TimeoutError) Error() string {... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/prompter/prompter_mock.go | internal/prompter/prompter_mock.go | // Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package prompter
import (
"sync"
)
// Ensure, that PrompterMock does implement Prompter.
// If this is not the case, regenerate this file with moq.
var _ Prompter = &PrompterMock{}
// PrompterMock is a mock implementation of Prompter.
//
// func Test... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/prompter/test.go | internal/prompter/test.go | package prompter
import (
"fmt"
"strings"
"testing"
ghPrompter "github.com/cli/go-gh/v2/pkg/prompter"
"github.com/stretchr/testify/assert"
)
func NewMockPrompter(t *testing.T) *MockPrompter {
m := &MockPrompter{
t: t,
PrompterMock: *ghPrompter.NewMock(t),
authTokenStubs: ... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/prompter/prompter.go | internal/prompter/prompter.go | package prompter
import (
"fmt"
"slices"
"strings"
"github.com/AlecAivazis/survey/v2"
"github.com/charmbracelet/huh"
"github.com/cli/cli/v2/internal/ghinstance"
"github.com/cli/cli/v2/pkg/iostreams"
"github.com/cli/cli/v2/pkg/surveyext"
ghPrompter "github.com/cli/go-gh/v2/pkg/prompter"
)
//go:generate moq -... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/prompter/accessible_prompter_test.go | internal/prompter/accessible_prompter_test.go | //go:build !windows
package prompter_test
import (
"fmt"
"io"
"slices"
"strings"
"testing"
"time"
"github.com/Netflix/go-expect"
"github.com/cli/cli/v2/internal/prompter"
"github.com/cli/cli/v2/pkg/iostreams"
"github.com/creack/pty"
"github.com/hinshun/vt10x"
"github.com/stretchr/testify/assert"
"github... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/featuredetection/feature_detection_test.go | internal/featuredetection/feature_detection_test.go | package featuredetection
import (
"net/http"
"testing"
"github.com/MakeNowJust/heredoc"
"github.com/cli/cli/v2/internal/gh"
"github.com/cli/cli/v2/pkg/httpmock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestIssueFeatures(t *testing.T) {
tests := []struct {
name ... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/featuredetection/detector_mock.go | internal/featuredetection/detector_mock.go | package featuredetection
import "github.com/cli/cli/v2/internal/gh"
type DisabledDetectorMock struct{}
func (md *DisabledDetectorMock) IssueFeatures() (IssueFeatures, error) {
return IssueFeatures{}, nil
}
func (md *DisabledDetectorMock) PullRequestFeatures() (PullRequestFeatures, error) {
return PullRequestFeatu... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/featuredetection/feature_detection.go | internal/featuredetection/feature_detection.go | package featuredetection
import (
"net/http"
"github.com/cli/cli/v2/api"
"github.com/cli/cli/v2/internal/gh"
"github.com/hashicorp/go-version"
"golang.org/x/sync/errgroup"
ghauth "github.com/cli/go-gh/v2/pkg/auth"
)
type Detector interface {
IssueFeatures() (IssueFeatures, error)
PullRequestFeatures() (Pull... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/build/build.go | internal/build/build.go | package build
import (
"os"
"runtime/debug"
)
// Version is dynamically set by the toolchain or overridden by the Makefile.
var Version = "DEV"
// Date is dynamically set at build time in the Makefile.
var Date = "" // YYYY-MM-DD
func init() {
if Version == "DEV" {
if info, ok := debug.ReadBuildInfo(); ok && i... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/docs/man.go | internal/docs/man.go | package docs
import (
"bytes"
"fmt"
"io"
"os"
"path/filepath"
"strconv"
"strings"
"time"
"github.com/cli/cli/v2/internal/text"
"github.com/cli/cli/v2/pkg/cmd/root"
"github.com/cpuguy83/go-md2man/v2/md2man"
"github.com/spf13/cobra"
"github.com/spf13/cobra/doc"
"github.com/spf13/pflag"
)
// GenManTree wi... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/docs/docs_test.go | internal/docs/docs_test.go | package docs
import (
"strings"
"testing"
"github.com/spf13/cobra"
)
func emptyRun(*cobra.Command, []string) {}
func init() {
rootCmd.PersistentFlags().StringP("rootflag", "r", "two", "")
rootCmd.PersistentFlags().StringP("strtwo", "t", "two", "help message for parent flag strtwo")
echoCmd.PersistentFlags().... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/docs/markdown_test.go | internal/docs/markdown_test.go | package docs
import (
"bytes"
"os"
"path/filepath"
"testing"
"github.com/spf13/cobra"
)
func TestGenMdDoc(t *testing.T) {
linkHandler := func(s string) string { return s }
// We generate on subcommand so we have both subcommands and parents.
buf := new(bytes.Buffer)
if err := genMarkdownCustom(echoCmd, buf... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/docs/man_test.go | internal/docs/man_test.go | package docs
import (
"bufio"
"bytes"
"fmt"
"os"
"path/filepath"
"strings"
"testing"
"github.com/spf13/cobra"
)
func translate(in string) string {
return strings.Replace(in, "-", "\\-", -1)
}
func TestGenManDoc(t *testing.T) {
header := &GenManHeader{
Title: "Project",
Section: "1",
}
// We gener... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/docs/markdown.go | internal/docs/markdown.go | package docs
import (
"fmt"
"html/template"
"io"
"os"
"path/filepath"
"strings"
"github.com/cli/cli/v2/internal/text"
"github.com/cli/cli/v2/pkg/cmd/root"
"github.com/spf13/cobra"
"github.com/spf13/cobra/doc"
"github.com/spf13/pflag"
)
func printJSONFields(w io.Writer, cmd *cobra.Command) {
raw, ok := cm... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/update/update_test.go | internal/update/update_test.go | package update
import (
"context"
"fmt"
"log"
"net/http"
"os"
"path/filepath"
"testing"
"time"
"github.com/cli/cli/v2/pkg/cmd/extension"
"github.com/cli/cli/v2/pkg/extensions"
"github.com/cli/cli/v2/pkg/httpmock"
"github.com/stretchr/testify/require"
)
func TestCheckForUpdate(t *testing.T) {
scenarios :... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/update/update.go | internal/update/update.go | package update
import (
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
"path/filepath"
"regexp"
"strconv"
"strings"
"time"
"github.com/cli/cli/v2/pkg/extensions"
"github.com/hashicorp/go-version"
"github.com/mattn/go-isatty"
"gopkg.in/yaml.v3"
)
var gitDescribeSuffixRE = regexp.MustCompile(`\d+-... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/codespaces/ssh.go | internal/codespaces/ssh.go | package codespaces
import (
"context"
"fmt"
"os"
"os/exec"
"strconv"
"strings"
"github.com/cli/safeexec"
)
type printer interface {
Printf(fmt string, v ...interface{})
}
// Shell runs an interactive secure shell over an existing
// port-forwarding session. It runs until the shell is terminated
// (includin... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/codespaces/codespaces_test.go | internal/codespaces/codespaces_test.go | package codespaces
import (
"context"
"net/http"
"testing"
"time"
"github.com/cenkalti/backoff/v4"
"github.com/cli/cli/v2/internal/codespaces/api"
)
func init() {
// Set the backoff to 0 for testing so that they run quickly
codespaceStatePollingBackoff = backoff.NewConstantBackOff(time.Second * 0)
}
// This... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/codespaces/ssh_test.go | internal/codespaces/ssh_test.go | package codespaces
import (
"fmt"
"testing"
)
type parseTestCase struct {
Args []string
ParsedArgs []string
Command []string
Error string
}
func TestParseSSHArgs(t *testing.T) {
testCases := []parseTestCase{
{}, // empty test case
{
Args: []string{"-X", "-Y"},
ParsedArgs: []strin... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/codespaces/codespaces.go | internal/codespaces/codespaces.go | package codespaces
import (
"context"
"errors"
"fmt"
"net"
"net/http"
"time"
"github.com/cenkalti/backoff/v4"
"github.com/cli/cli/v2/internal/codespaces/api"
"github.com/cli/cli/v2/internal/codespaces/connection"
)
// codespaceStatePollingBackoff is the delay between state polls while waiting for codespaces... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/codespaces/states.go | internal/codespaces/states.go | package codespaces
import (
"bytes"
"context"
"encoding/json"
"fmt"
"io"
"time"
"github.com/cli/cli/v2/internal/codespaces/api"
"github.com/cli/cli/v2/internal/codespaces/portforwarder"
"github.com/cli/cli/v2/internal/codespaces/rpc"
"github.com/cli/cli/v2/internal/text"
)
// PostCreateStateStatus is a str... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/codespaces/rpc/invoker_test.go | internal/codespaces/rpc/invoker_test.go | package rpc
import (
"context"
"fmt"
"net"
"strconv"
"testing"
"github.com/cli/cli/v2/internal/codespaces/rpc/codespace"
"github.com/cli/cli/v2/internal/codespaces/rpc/jupyter"
"github.com/cli/cli/v2/internal/codespaces/rpc/ssh"
rpctest "github.com/cli/cli/v2/internal/codespaces/rpc/test"
"google.golang.org... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/codespaces/rpc/invoker.go | internal/codespaces/rpc/invoker.go | package rpc
// gRPC client implementation to be able to connect to the gRPC server and perform the following operations:
// - Start a remote JupyterLab server
import (
"context"
"fmt"
"net"
"os"
"regexp"
"strconv"
"strings"
"time"
"github.com/cli/cli/v2/internal/codespaces/portforwarder"
"github.com/cli/cl... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/codespaces/rpc/jupyter/jupyter_server_host_service.v1_grpc.pb.go | internal/codespaces/rpc/jupyter/jupyter_server_host_service.v1_grpc.pb.go | // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v3.12.4
// source: jupyter/jupyter_server_host_service.v1.proto
package jupyter
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.gol... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/codespaces/rpc/jupyter/jupyter_server_host_service.v1.proto.mock.go | internal/codespaces/rpc/jupyter/jupyter_server_host_service.v1.proto.mock.go | // Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package jupyter
import (
context "context"
sync "sync"
)
// Ensure, that JupyterServerHostServerMock does implement JupyterServerHostServer.
// If this is not the case, regenerate this file with moq.
var _ JupyterServerHostServer = &JupyterServerHost... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/codespaces/rpc/jupyter/jupyter_server_host_service.v1.pb.go | internal/codespaces/rpc/jupyter/jupyter_server_host_service.v1.pb.go | // Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.1
// protoc v3.12.4
// source: jupyter/jupyter_server_host_service.v1.proto
package jupyter
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/codespaces/rpc/test/port_forwarder.go | internal/codespaces/rpc/test/port_forwarder.go | package test
import (
"context"
"fmt"
"io"
"net"
"github.com/cli/cli/v2/internal/codespaces/portforwarder"
"github.com/microsoft/dev-tunnels/go/tunnels"
)
type PortForwarder struct{}
// Close implements portforwarder.PortForwarder.
func (PortForwarder) Close() error {
return nil
}
// ConnectToForwardedPort ... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/codespaces/rpc/codespace/codespace_host_service.v1.pb.go | internal/codespaces/rpc/codespace/codespace_host_service.v1.pb.go | // Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.1
// protoc v3.12.4
// source: codespace/codespace_host_service.v1.proto
package codespace
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
r... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/codespaces/rpc/codespace/codespace_host_service.v1_grpc.pb.go | internal/codespaces/rpc/codespace/codespace_host_service.v1_grpc.pb.go | // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v3.12.4
// source: codespace/codespace_host_service.v1.proto
package codespace
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.gola... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/codespaces/rpc/codespace/codespace_host_service.v1.proto.mock.go | internal/codespaces/rpc/codespace/codespace_host_service.v1.proto.mock.go | // Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package codespace
import (
context "context"
sync "sync"
)
// Ensure, that CodespaceHostServerMock does implement CodespaceHostServer.
// If this is not the case, regenerate this file with moq.
var _ CodespaceHostServer = &CodespaceHostServerMock{}
... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/codespaces/rpc/ssh/ssh_server_host_service.v1.proto.mock.go | internal/codespaces/rpc/ssh/ssh_server_host_service.v1.proto.mock.go | // Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package ssh
import (
context "context"
sync "sync"
)
// Ensure, that SshServerHostServerMock does implement SshServerHostServer.
// If this is not the case, regenerate this file with moq.
var _ SshServerHostServer = &SshServerHostServerMock{}
// Ssh... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/codespaces/rpc/ssh/ssh_server_host_service.v1.pb.go | internal/codespaces/rpc/ssh/ssh_server_host_service.v1.pb.go | // Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.1
// protoc v3.12.4
// source: ssh/ssh_server_host_service.v1.proto
package ssh
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "ref... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/codespaces/rpc/ssh/ssh_server_host_service.v1_grpc.pb.go | internal/codespaces/rpc/ssh/ssh_server_host_service.v1_grpc.pb.go | // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v3.12.4
// source: ssh/ssh_server_host_service.v1.proto
package ssh
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/codespaces/connection/connection.go | internal/codespaces/connection/connection.go | package connection
import (
"context"
"fmt"
"io"
"log"
"net/http"
"net/url"
"sync"
"github.com/cli/cli/v2/internal/codespaces/api"
"github.com/microsoft/dev-tunnels/go/tunnels"
)
const (
clientName = "gh"
)
type TunnelClient struct {
*tunnels.Client
connected bool
mu sync.Mutex
}
type Codespace... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/codespaces/connection/tunnels_api_server_mock.go | internal/codespaces/connection/tunnels_api_server_mock.go | package connection
import (
"context"
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/json"
"encoding/pem"
"fmt"
"io"
"log"
"net/http"
"net/http/httptest"
"net/url"
"regexp"
"strconv"
"strings"
"sync"
"time"
"github.com/gorilla/websocket"
"github.com/microsoft/dev-tunnels/go/tunnels"
tunnelssh ... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/codespaces/connection/connection_test.go | internal/codespaces/connection/connection_test.go | package connection
import (
"context"
"reflect"
"testing"
"github.com/cli/cli/v2/internal/codespaces/api"
"github.com/microsoft/dev-tunnels/go/tunnels"
)
func TestNewCodespaceConnection(t *testing.T) {
ctx := context.Background()
// Create a mock codespace
connection := api.CodespaceConnection{
TunnelProp... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/codespaces/portforwarder/port_forwarder_test.go | internal/codespaces/portforwarder/port_forwarder_test.go | package portforwarder
import (
"context"
"testing"
"github.com/cli/cli/v2/internal/codespaces/api"
"github.com/cli/cli/v2/internal/codespaces/connection"
"github.com/microsoft/dev-tunnels/go/tunnels"
)
func TestNewPortForwarder(t *testing.T) {
ctx := context.Background()
// Create a mock codespace
codespace... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/codespaces/portforwarder/port_forwarder.go | internal/codespaces/portforwarder/port_forwarder.go | package portforwarder
import (
"context"
"fmt"
"io"
"net"
"strings"
"github.com/cli/cli/v2/internal/codespaces/connection"
"github.com/microsoft/dev-tunnels/go/tunnels"
)
const (
githubSubjectId = "1"
InternalPortLabel = "InternalPort"
UserForwardedPortLabel = "UserForwardedPort"
)
const (
Pr... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/codespaces/api/api.go | internal/codespaces/api/api.go | package api
// For descriptions of service interfaces, see:
// - https://docs.github.com/en/rest/reference/repos (for api.github.com)
// - https://github.com/github/github/blob/master/app/api/codespaces.rb (for vscs_internal)
// TODO(adonovan): replace the last link with a public doc URL when available.
// TODO(adono... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | true |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/codespaces/api/api_test.go | internal/codespaces/api/api_test.go | package api
import (
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
"net/http/httptest"
"reflect"
"strconv"
"testing"
"github.com/cli/cli/v2/internal/config"
"github.com/cli/cli/v2/internal/gh"
ghmock "github.com/cli/cli/v2/internal/gh/mock"
"github.com/cli/cli/v2/pkg/cmdutil"
)
func generateCodesp... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/run/stub.go | internal/run/stub.go | package run
import (
"fmt"
"os/exec"
"path/filepath"
"regexp"
"strings"
)
const (
gitAuthRE = `-c credential(?:\..+)?\.helper= -c credential(?:\..+)?\.helper=!"[^"]+" auth git-credential `
)
type T interface {
Helper()
Errorf(string, ...interface{})
}
// Stub installs a catch-all for all external commands i... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/run/run.go | internal/run/run.go | package run
import (
"bytes"
"errors"
"fmt"
"io"
"os"
"os/exec"
"path/filepath"
"strings"
"github.com/cli/cli/v2/utils"
)
// Runnable is typically an exec.Cmd or its stub in tests
type Runnable interface {
Output() ([]byte, error)
Run() error
}
// PrepareCmd extends exec.Cmd with extra error reporting fe... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/config/stub.go | internal/config/stub.go | package config
import (
"io"
"os"
"path/filepath"
"testing"
"github.com/cli/cli/v2/internal/gh"
ghmock "github.com/cli/cli/v2/internal/gh/mock"
"github.com/cli/cli/v2/internal/keyring"
o "github.com/cli/cli/v2/pkg/option"
ghConfig "github.com/cli/go-gh/v2/pkg/config"
)
func NewBlankConfig() *ghmock.ConfigMo... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/config/migrate_test.go | internal/config/migrate_test.go | package config
import (
"bytes"
"errors"
"io"
"os"
"path/filepath"
"testing"
ghmock "github.com/cli/cli/v2/internal/gh/mock"
ghConfig "github.com/cli/go-gh/v2/pkg/config"
"github.com/stretchr/testify/require"
)
func TestMigrationAppliedSuccessfully(t *testing.T) {
readConfig := StubWriteConfig(t)
// Give... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/config/config.go | internal/config/config.go | package config
import (
"errors"
"fmt"
"os"
"path/filepath"
"slices"
"github.com/cli/cli/v2/internal/gh"
"github.com/cli/cli/v2/internal/keyring"
o "github.com/cli/cli/v2/pkg/option"
ghauth "github.com/cli/go-gh/v2/pkg/auth"
ghConfig "github.com/cli/go-gh/v2/pkg/config"
)
// Important: some of the followin... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/config/config_test.go | internal/config/config_test.go | package config
import (
"fmt"
"testing"
"github.com/stretchr/testify/require"
"github.com/cli/cli/v2/internal/gh"
ghConfig "github.com/cli/go-gh/v2/pkg/config"
)
func newTestConfig() *cfg {
return &cfg{
cfg: ghConfig.ReadFromString(""),
}
}
func TestNewConfigProvidesFallback(t *testing.T) {
var spiedCfg ... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/config/auth_config_test.go | internal/config/auth_config_test.go | package config
import (
"errors"
"testing"
"github.com/cli/cli/v2/internal/config/migration"
"github.com/cli/cli/v2/internal/keyring"
ghConfig "github.com/cli/go-gh/v2/pkg/config"
"github.com/stretchr/testify/require"
)
// Note that NewIsolatedTestConfig sets up a Mock keyring as well
func newTestAuthConfig(t ... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/config/migration/multi_account.go | internal/config/migration/multi_account.go | package migration
import (
"errors"
"fmt"
"net/http"
"github.com/cli/cli/v2/internal/keyring"
ghAPI "github.com/cli/go-gh/v2/pkg/api"
"github.com/cli/go-gh/v2/pkg/config"
)
var noTokenError = errors.New("no token found")
type CowardlyRefusalError struct {
err error
}
func (e CowardlyRefusalError) Error() st... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/config/migration/multi_account_test.go | internal/config/migration/multi_account_test.go | package migration_test
import (
"errors"
"fmt"
"testing"
"github.com/cli/cli/v2/internal/config/migration"
"github.com/cli/cli/v2/internal/keyring"
"github.com/cli/cli/v2/pkg/httpmock"
"github.com/cli/go-gh/v2/pkg/config"
"github.com/stretchr/testify/require"
)
func TestMigration(t *testing.T) {
cfg := conf... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/authflow/flow.go | internal/authflow/flow.go | package authflow
import (
"bufio"
"fmt"
"io"
"net/http"
"net/url"
"github.com/atotto/clipboard"
"github.com/cli/cli/v2/api"
"github.com/cli/cli/v2/internal/browser"
"github.com/cli/cli/v2/internal/ghinstance"
"github.com/cli/cli/v2/pkg/iostreams"
"github.com/cli/oauth"
ghauth "github.com/cli/go-gh/v2/pkg... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/authflow/flow_test.go | internal/authflow/flow_test.go | package authflow
import (
"testing"
"github.com/stretchr/testify/assert"
)
func Test_getCallbackURI(t *testing.T) {
tests := []struct {
name string
oauthHost string
want string
}{
{
name: "dotcom",
oauthHost: "github.com",
want: "http://127.0.0.1/callback",
},
{
name: ... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/authflow/success.go | internal/authflow/success.go | package authflow
const oauthSuccessPage = `
<!doctype html>
<meta charset="utf-8">
<title>Success: GitHub CLI</title>
<style type="text/css">
body {
color: #1B1F23;
background: #F6F8FA;
font-size: 14px;
font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
line-height: 1.5;
max-width: 620px... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/ghinstance/host.go | internal/ghinstance/host.go | package ghinstance
import (
"errors"
"fmt"
"strings"
ghauth "github.com/cli/go-gh/v2/pkg/auth"
)
// DefaultHostname is the domain name of the default GitHub instance.
const defaultHostname = "github.com"
// Localhost is the domain name of a local GitHub instance.
const localhost = "github.localhost"
// Tenancy... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/ghinstance/host_test.go | internal/ghinstance/host_test.go | package ghinstance
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestTenantName(t *testing.T) {
tests := []struct {
host string
wantTenant string
wantFound bool
}{
{
host: "github.com",
wantTenant: "github.com",
},
{
host: "github.localhost",
wantTenant... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/text/text.go | internal/text/text.go | package text
import (
"fmt"
"math"
"net/url"
"regexp"
"slices"
"strings"
"time"
"github.com/cli/go-gh/v2/pkg/text"
"golang.org/x/text/cases"
"golang.org/x/text/language"
)
var whitespaceRE = regexp.MustCompile(`\s+`)
func Indent(s, indent string) string {
return text.Indent(s, indent)
}
// Title returns... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/text/text_test.go | internal/text/text_test.go | package text
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestRemoveExcessiveWhitespace(t *testing.T) {
tests := []struct {
name string
input string
want string
}{
{
name: "nothing to remove",
input: "one two three",
want: "one two three",
},
{
name: "whites... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/ghrepo/repo.go | internal/ghrepo/repo.go | package ghrepo
import (
"fmt"
"net/url"
"strings"
"github.com/cli/cli/v2/internal/ghinstance"
ghauth "github.com/cli/go-gh/v2/pkg/auth"
"github.com/cli/go-gh/v2/pkg/repository"
)
// Interface describes an object that represents a GitHub repository
type Interface interface {
RepoName() string
RepoOwner() stri... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/ghrepo/repo_test.go | internal/ghrepo/repo_test.go | package ghrepo
import (
"errors"
"fmt"
"net/url"
"testing"
)
func Test_repoFromURL(t *testing.T) {
tests := []struct {
name string
input string
result string
host string
err error
}{
{
name: "github.com URL",
input: "https://github.com/monalisa/octo-cat.git",
result: "monalisa/oc... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/browser/stub.go | internal/browser/stub.go | package browser
type Stub struct {
urls []string
}
func (b *Stub) Browse(url string) error {
b.urls = append(b.urls, url)
return nil
}
func (b *Stub) BrowsedURL() string {
if len(b.urls) > 0 {
return b.urls[0]
}
return ""
}
type _testing interface {
Errorf(string, ...interface{})
Helper()
}
func (b *Stub... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/internal/browser/browser.go | internal/browser/browser.go | package browser
import (
"io"
ghBrowser "github.com/cli/go-gh/v2/pkg/browser"
)
type Browser interface {
Browse(string) error
}
func New(launcher string, stdout, stderr io.Writer) Browser {
b := ghBrowser.New(launcher, stdout, stderr)
return b
}
| go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/script/build.go | script/build.go | // Build tasks for the GitHub CLI project.
//
// Usage: go run script/build.go [<tasks>...] [<env>...]
//
// Known tasks are:
//
// bin/gh:
// Builds the main executable.
// Supported environment variables:
// - GH_VERSION: determined from source by default
// - GH_OAUTH_CLIENT_ID
// - GH_OAUTH_C... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/context/remote.go | context/remote.go | package context
import (
"fmt"
"net/url"
"strings"
"github.com/cli/cli/v2/git"
"github.com/cli/cli/v2/internal/ghrepo"
)
// Remotes represents a set of git remotes
type Remotes []*Remote
// FindByName returns the first Remote whose name matches the list
func (r Remotes) FindByName(names ...string) (*Remote, er... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/context/context.go | context/context.go | // TODO: rename this package to avoid clash with stdlib
package context
import (
"errors"
"fmt"
"slices"
"sort"
"github.com/cli/cli/v2/api"
"github.com/cli/cli/v2/internal/ghrepo"
"github.com/cli/cli/v2/pkg/iostreams"
)
// Cap the number of git remotes to look up, since the user might have an
// unusually lar... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
cli/cli | https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/context/remote_test.go | context/remote_test.go | package context
import (
"net/url"
"testing"
"github.com/cli/cli/v2/git"
"github.com/cli/cli/v2/internal/ghrepo"
"github.com/stretchr/testify/assert"
)
func Test_Remotes_FindByName(t *testing.T) {
list := Remotes{
&Remote{Remote: &git.Remote{Name: "mona"}, Repo: ghrepo.New("monalisa", "myfork")},
&Remote{R... | go | MIT | c534a758887878331dda780aeb696b113f37b4ab | 2026-01-07T08:35:47.579368Z | false |
ollama/ollama | https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/main.go | main.go | package main
import (
"context"
"github.com/spf13/cobra"
"github.com/ollama/ollama/cmd"
)
func main() {
cobra.CheckErr(cmd.NewCLI().ExecuteContext(context.Background()))
}
| go | MIT | 626af2d80973270c4d59b8df7153ac47ad67ed7b | 2026-01-07T08:35:43.337630Z | false |
ollama/ollama | https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/ml/path.go | ml/path.go | package ml
import (
"os"
"path/filepath"
"runtime"
)
// LibPath is a path to lookup dynamic libraries
// in development it's usually 'build/lib/ollama'
// in distribution builds it's 'lib/ollama' on Windows
// '../lib/ollama' on Linux and the executable's directory on macOS
// note: distribution builds, additional... | go | MIT | 626af2d80973270c4d59b8df7153ac47ad67ed7b | 2026-01-07T08:35:43.337630Z | false |
ollama/ollama | https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/ml/device.go | ml/device.go | package ml
import (
"context"
"encoding/binary"
"encoding/json"
"fmt"
"hash/maphash"
"io"
"log/slog"
"math"
"net/http"
"runtime"
"slices"
"sort"
"strconv"
"strings"
"time"
"github.com/ollama/ollama/format"
"github.com/ollama/ollama/logutil"
)
// GPULayers is a set of layers to be allocated on a sing... | go | MIT | 626af2d80973270c4d59b8df7153ac47ad67ed7b | 2026-01-07T08:35:43.337630Z | false |
ollama/ollama | https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/ml/backend.go | ml/backend.go | package ml
import (
"bytes"
"context"
"encoding/binary"
"fmt"
"math"
"slices"
"strconv"
"strings"
"github.com/ollama/ollama/fs"
)
type Backend interface {
// Close frees all memory associated with this backend
Close()
Load(ctx context.Context, progress func(float32)) error
// BackendMemory returns the... | go | MIT | 626af2d80973270c4d59b8df7153ac47ad67ed7b | 2026-01-07T08:35:43.337630Z | false |
ollama/ollama | https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/ml/backend/backend.go | ml/backend/backend.go | package backend
import (
_ "github.com/ollama/ollama/ml/backend/ggml"
)
| go | MIT | 626af2d80973270c4d59b8df7153ac47ad67ed7b | 2026-01-07T08:35:43.337630Z | false |
ollama/ollama | https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/ml/backend/ggml/quantization.go | ml/backend/ggml/quantization.go | package ggml
// #cgo CPPFLAGS: -I${SRCDIR}/ggml/src
// #include <stdlib.h>
// #include <stdint.h>
// #include "ggml.h"
// #include "ggml-cpu.h"
// #include "ggml-backend.h"
// #include "ggml-quants.h"
import "C"
import (
"unsafe"
fsggml "github.com/ollama/ollama/fs/ggml"
)
// ConvertToF32 converts (dequantizes) t... | go | MIT | 626af2d80973270c4d59b8df7153ac47ad67ed7b | 2026-01-07T08:35:43.337630Z | false |
ollama/ollama | https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/ml/backend/ggml/threads_debug.go | ml/backend/ggml/threads_debug.go | //go:build debug
package ggml
func Threads(_ int) int {
return 1
}
| go | MIT | 626af2d80973270c4d59b8df7153ac47ad67ed7b | 2026-01-07T08:35:43.337630Z | false |
ollama/ollama | https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/ml/backend/ggml/threads.go | ml/backend/ggml/threads.go | //go:build !debug
package ggml
func Threads(n int) int {
return n
}
| go | MIT | 626af2d80973270c4d59b8df7153ac47ad67ed7b | 2026-01-07T08:35:43.337630Z | false |
ollama/ollama | https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/ml/backend/ggml/ggml_test.go | ml/backend/ggml/ggml_test.go | package ggml
import (
"errors"
"fmt"
"os"
"testing"
"github.com/google/go-cmp/cmp"
"github.com/ollama/ollama/fs/ggml"
"github.com/ollama/ollama/ml"
)
func setup(tb testing.TB) ml.Context {
tb.Helper()
f, err := os.CreateTemp(tb.TempDir(), "*.bin")
if err != nil {
tb.Fatal(err)
}
defer f.Close()
if e... | go | MIT | 626af2d80973270c4d59b8df7153ac47ad67ed7b | 2026-01-07T08:35:43.337630Z | false |
ollama/ollama | https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/ml/backend/ggml/ggml.go | ml/backend/ggml/ggml.go | package ggml
// #cgo linux LDFLAGS: -lrt -lpthread -ldl -lstdc++ -lm
// #cgo windows LDFLAGS: -lpthread
// #cgo CPPFLAGS: -I${SRCDIR}/ggml/include
// #include <stdlib.h>
// #include <stdint.h>
// #include "ggml.h"
// #include "ggml-cpu.h"
// #include "ggml-backend.h"
import "C"
import (
"cmp"
"context"
"encoding/b... | go | MIT | 626af2d80973270c4d59b8df7153ac47ad67ed7b | 2026-01-07T08:35:43.337630Z | true |
ollama/ollama | https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/ml/backend/ggml/ggml/src/ggml_darwin_arm64.go | ml/backend/ggml/ggml/src/ggml_darwin_arm64.go | package ggml
// #cgo CPPFLAGS: -DGGML_USE_METAL -DGGML_METAL_EMBED_LIBRARY -DGGML_USE_BLAS
// #cgo LDFLAGS: -framework Foundation
import "C"
import (
_ "github.com/ollama/ollama/ml/backend/ggml/ggml/src/ggml-blas"
_ "github.com/ollama/ollama/ml/backend/ggml/ggml/src/ggml-metal"
)
| go | MIT | 626af2d80973270c4d59b8df7153ac47ad67ed7b | 2026-01-07T08:35:43.337630Z | false |
ollama/ollama | https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/ml/backend/ggml/ggml/src/ggml.go | ml/backend/ggml/ggml/src/ggml.go | package ggml
// #cgo CXXFLAGS: -std=c++17
// #cgo CPPFLAGS: -DNDEBUG -DGGML_USE_CPU -DGGML_VERSION=0x0 -DGGML_COMMIT=0x0
// #cgo CPPFLAGS: -I${SRCDIR}/../include -I${SRCDIR}/ggml-cpu
// #cgo windows CFLAGS: -Wno-dll-attribute-on-redeclaration
// #cgo windows LDFLAGS: -lmsvcrt -static -static-libgcc -static-libstdc++
/... | go | MIT | 626af2d80973270c4d59b8df7153ac47ad67ed7b | 2026-01-07T08:35:43.337630Z | false |
ollama/ollama | https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/ml/backend/ggml/ggml/src/ggml-metal/metal.go | ml/backend/ggml/ggml/src/ggml-metal/metal.go | //go:build darwin && arm64
package metal
//go:generate sh -c "{ echo // Code generated by 'go generate'. DO NOT EDIT.; sed -e '/__embed_ggml-common.h__/r ../ggml-common.h' -e '/__embed_ggml-common.h__/d' -e '/#include \"ggml-metal-impl.h\"/r ggml-metal-impl.h' -e '/#include \"ggml-metal-impl.h\"/d' ggml-metal.metal; ... | go | MIT | 626af2d80973270c4d59b8df7153ac47ad67ed7b | 2026-01-07T08:35:43.337630Z | false |
ollama/ollama | https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/ml/backend/ggml/ggml/src/ggml-cpu/cpu_debug.go | ml/backend/ggml/ggml/src/ggml-cpu/cpu_debug.go | //go:build debug
package cpu
// #cgo CPPFLAGS: -DOLLAMA_DEBUG
import "C"
| go | MIT | 626af2d80973270c4d59b8df7153ac47ad67ed7b | 2026-01-07T08:35:43.337630Z | false |
ollama/ollama | https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/ml/backend/ggml/ggml/src/ggml-cpu/cpu_amd64.go | ml/backend/ggml/ggml/src/ggml-cpu/cpu_amd64.go | package cpu
import _ "github.com/ollama/ollama/ml/backend/ggml/ggml/src/ggml-cpu/arch/x86"
| go | MIT | 626af2d80973270c4d59b8df7153ac47ad67ed7b | 2026-01-07T08:35:43.337630Z | false |
ollama/ollama | https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/ml/backend/ggml/ggml/src/ggml-cpu/cpu_arm64.go | ml/backend/ggml/ggml/src/ggml-cpu/cpu_arm64.go | package cpu
import _ "github.com/ollama/ollama/ml/backend/ggml/ggml/src/ggml-cpu/arch/arm"
| go | MIT | 626af2d80973270c4d59b8df7153ac47ad67ed7b | 2026-01-07T08:35:43.337630Z | false |
ollama/ollama | https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/ml/backend/ggml/ggml/src/ggml-cpu/cpu.go | ml/backend/ggml/ggml/src/ggml-cpu/cpu.go | package cpu
// #cgo CFLAGS: -O3 -Wno-implicit-function-declaration
// #cgo CXXFLAGS: -std=c++17
// #cgo CPPFLAGS: -I${SRCDIR}/amx -I${SRCDIR}/llamafile -I${SRCDIR}/.. -I${SRCDIR}/../../include
// #cgo CPPFLAGS: -DNDEBUG -DGGML_USE_LLAMAFILE
// #cgo linux CPPFLAGS: -D_GNU_SOURCE
// #cgo darwin,arm64 CPPFLAGS: -DGGML_US... | go | MIT | 626af2d80973270c4d59b8df7153ac47ad67ed7b | 2026-01-07T08:35:43.337630Z | false |
ollama/ollama | https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/ml/backend/ggml/ggml/src/ggml-cpu/llamafile/llamafile.go | ml/backend/ggml/ggml/src/ggml-cpu/llamafile/llamafile.go | package llamafile
// #cgo CXXFLAGS: -std=c++17
// #cgo CPPFLAGS: -I${SRCDIR}/.. -I${SRCDIR}/../.. -I${SRCDIR}/../../../include
import "C"
| go | MIT | 626af2d80973270c4d59b8df7153ac47ad67ed7b | 2026-01-07T08:35:43.337630Z | false |
ollama/ollama | https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/ml/backend/ggml/ggml/src/ggml-cpu/arch/arm/arm.go | ml/backend/ggml/ggml/src/ggml-cpu/arch/arm/arm.go | //go:build arm64
package arm
// #cgo CXXFLAGS: -std=c++17
// #cgo CPPFLAGS: -I${SRCDIR}/../.. -I${SRCDIR}/../../.. -I${SRCDIR}/../../../../include -DHWCAP2_SVE2="2"
import "C"
| go | MIT | 626af2d80973270c4d59b8df7153ac47ad67ed7b | 2026-01-07T08:35:43.337630Z | false |
ollama/ollama | https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/ml/backend/ggml/ggml/src/ggml-cpu/arch/x86/x86.go | ml/backend/ggml/ggml/src/ggml-cpu/arch/x86/x86.go | package x86
// #cgo CXXFLAGS: -std=c++17
// #cgo CPPFLAGS: -I${SRCDIR}/../.. -I${SRCDIR}/../../.. -I${SRCDIR}/../../../../include
import "C"
| go | MIT | 626af2d80973270c4d59b8df7153ac47ad67ed7b | 2026-01-07T08:35:43.337630Z | false |
ollama/ollama | https://github.com/ollama/ollama/blob/626af2d80973270c4d59b8df7153ac47ad67ed7b/ml/backend/ggml/ggml/src/ggml-blas/blas.go | ml/backend/ggml/ggml/src/ggml-blas/blas.go | //go:build darwin && arm64
package blas
// #cgo CXXFLAGS: -std=c++11
// #cgo CPPFLAGS: -DGGML_USE_BLAS
// #cgo CPPFLAGS: -I${SRCDIR}/.. -I${SRCDIR}/../../include
// #cgo darwin,arm64 CPPFLAGS: -DGGML_BLAS_USE_ACCELERATE -DACCELERATE_NEW_LAPACK -DACCELERATE_LAPACK_ILP64
// #cgo darwin,arm64 LDFLAGS: -framework Acceler... | go | MIT | 626af2d80973270c4d59b8df7153ac47ad67ed7b | 2026-01-07T08:35:43.337630Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.