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 |
|---|---|---|---|---|---|---|---|---|
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/transport/http/jsonrpc/client.go | transport/http/jsonrpc/client.go | package jsonrpc
import (
"bytes"
"context"
"encoding/json"
"io/ioutil"
"net/http"
"net/url"
"sync/atomic"
"github.com/go-kit/kit/endpoint"
httptransport "github.com/go-kit/kit/transport/http"
)
// Client wraps a JSON RPC method and provides a method that implements endpoint.Endpoint.
type Client struct {
c... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/transport/http/jsonrpc/error.go | transport/http/jsonrpc/error.go | package jsonrpc
// Error defines a JSON RPC error that can be returned
// in a Response from the spec
// http://www.jsonrpc.org/specification#error_object
type Error struct {
Code int `json:"code"`
Message string `json:"message"`
Data interface{} `json:"data,omitempty"`
}
// Error implements err... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/transport/http/jsonrpc/request_response_types.go | transport/http/jsonrpc/request_response_types.go | package jsonrpc
import (
"context"
"encoding/json"
"net/http"
)
// Request defines a JSON RPC request from the spec
// http://www.jsonrpc.org/specification#request_object
type Request struct {
JSONRPC string `json:"jsonrpc"`
Method string `json:"method"`
Params json.RawMessage `json:"params"... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/transport/http/jsonrpc/server_test.go | transport/http/jsonrpc/server_test.go | package jsonrpc_test
import (
"context"
"encoding/json"
"errors"
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
"strings"
"testing"
"time"
"github.com/go-kit/kit/endpoint"
"github.com/go-kit/kit/transport/http/jsonrpc"
)
func addBody() io.Reader {
return body(`{"jsonrpc": "2.0", "method": "add", "param... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/transport/http/jsonrpc/error_test.go | transport/http/jsonrpc/error_test.go | package jsonrpc
import "testing"
func TestError(t *testing.T) {
wantCode := ParseError
sut := Error{
Code: wantCode,
}
gotCode := sut.ErrorCode()
if gotCode != wantCode {
t.Fatalf("want=%d, got=%d", gotCode, wantCode)
}
if sut.Error() == "" {
t.Fatal("Empty error string.")
}
want := "override"
sut.... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/transport/http/jsonrpc/client_test.go | transport/http/jsonrpc/client_test.go | package jsonrpc_test
import (
"context"
"encoding/json"
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
"net/url"
"testing"
"github.com/go-kit/kit/transport/http/jsonrpc"
)
type TestResponse struct {
Body io.ReadCloser
String string
}
type testServerResponseOptions struct {
Body string
Status int
}... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/transport/http/jsonrpc/encode_decode.go | transport/http/jsonrpc/encode_decode.go | package jsonrpc
import (
"encoding/json"
"github.com/go-kit/kit/endpoint"
"context"
)
// Server-Side Codec
// EndpointCodec defines a server Endpoint and its associated codecs
type EndpointCodec struct {
Endpoint endpoint.Endpoint
Decode DecodeRequestFunc
Encode EncodeResponseFunc
}
// EndpointCodecMap ... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/transport/http/jsonrpc/server.go | transport/http/jsonrpc/server.go | package jsonrpc
import (
"context"
"encoding/json"
"fmt"
"io"
"net/http"
httptransport "github.com/go-kit/kit/transport/http"
"github.com/go-kit/log"
)
type requestIDKeyType struct{}
var requestIDKey requestIDKeyType
// Server wraps an endpoint and implements http.Handler.
type Server struct {
ecm ... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/transport/http/jsonrpc/doc.go | transport/http/jsonrpc/doc.go | // Package jsonrpc provides a JSON RPC (v2.0) binding for endpoints.
// See http://www.jsonrpc.org/specification
package jsonrpc
| go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/transport/http/jsonrpc/request_response_types_test.go | transport/http/jsonrpc/request_response_types_test.go | package jsonrpc_test
import (
"encoding/json"
"fmt"
"testing"
"github.com/go-kit/kit/transport/http/jsonrpc"
)
func TestCanUnMarshalID(t *testing.T) {
cases := []struct {
JSON string
expType string
expValue interface{}
}{
{`12345`, "int", 12345},
{`12345.6`, "float", 12345.6},
{`"stringaling"`... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/transport/http/proto/client.go | transport/http/proto/client.go | package proto
import (
"bytes"
"context"
"errors"
"io/ioutil"
"net/http"
httptransport "github.com/go-kit/kit/transport/http"
"google.golang.org/protobuf/proto"
)
// EncodeProtoRequest is an EncodeRequestFunc that serializes the request as Protobuf.
// If the request implements Headerer, the provided headers ... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/transport/http/proto/proto_test.go | transport/http/proto/proto_test.go | package proto
import (
"context"
"io/ioutil"
"net/http"
"net/http/httptest"
"testing"
"google.golang.org/protobuf/proto"
)
func TestEncodeProtoRequest(t *testing.T) {
cat := &Cat{Name: "Ziggy", Age: 13, Breed: "Lumpy"}
r := httptest.NewRequest(http.MethodGet, "/cat", nil)
err := EncodeProtoRequest(context... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/transport/http/proto/proto_pb_test.go | transport/http/proto/proto_pb_test.go | // Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.26.0
// protoc v3.16.0
// source: proto_test.proto
package proto
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/transport/http/proto/server.go | transport/http/proto/server.go | package proto
import (
"context"
"errors"
"net/http"
httptransport "github.com/go-kit/kit/transport/http"
"google.golang.org/protobuf/proto"
)
// EncodeProtoResponse is an EncodeResponseFunc that serializes the response as Protobuf.
// Many Proto-over-HTTP services can use it as a sensible default. If the respo... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/transport/http/proto/generate.go | transport/http/proto/generate.go | package proto
//go:generate protoc proto_test.proto --go_out=. --go_opt=Mproto_test.proto=github.com/go-kit/kit/transport/http/proto --go_opt=paths=source_relative
//go:generate mv proto_test.pb.go proto_pb_test.go
| go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/log/sync.go | log/sync.go | package log
import (
"io"
"github.com/go-kit/log"
)
// SwapLogger wraps another logger that may be safely replaced while other
// goroutines use the SwapLogger concurrently. The zero value for a SwapLogger
// will discard all log events without error.
//
// SwapLogger serves well as a package global logger that ca... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/log/stdlib.go | log/stdlib.go | package log
import (
"io"
"github.com/go-kit/log"
)
// StdlibWriter implements io.Writer by invoking the stdlib log.Print. It's
// designed to be passed to a Go kit logger as the writer, for cases where
// it's necessary to redirect all Go kit log output to the stdlib logger.
//
// If you have any choice in the ma... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/log/nop_logger.go | log/nop_logger.go | package log
import "github.com/go-kit/log"
// NewNopLogger returns a logger that doesn't do anything.
func NewNopLogger() Logger {
return log.NewNopLogger()
}
| go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/log/log.go | log/log.go | package log
import (
"github.com/go-kit/log"
)
// Logger is the fundamental interface for all log operations. Log creates a
// log event from keyvals, a variadic sequence of alternating keys and values.
// Implementations must be safe for concurrent use by multiple goroutines. In
// particular, any implementation of... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/log/example_test.go | log/example_test.go | package log_test
import (
"math/rand"
"os"
"sync"
"time"
"github.com/go-kit/kit/log"
)
func Example_basic() {
logger := log.NewLogfmtLogger(os.Stdout)
type Task struct {
ID int
}
RunTask := func(task Task, logger log.Logger) {
logger.Log("taskID", task.ID, "event", "starting task")
logger.Log("task... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/log/value.go | log/value.go | package log
import (
"time"
"github.com/go-kit/log"
)
// A Valuer generates a log value. When passed to With, WithPrefix, or
// WithSuffix in a value element (odd indexes), it represents a dynamic
// value which is re-evaluated with each log event.
type Valuer = log.Valuer
// Timestamp returns a timestamp Valuer.... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/log/json_logger.go | log/json_logger.go | package log
import (
"io"
"github.com/go-kit/log"
)
// NewJSONLogger returns a Logger that encodes keyvals to the Writer as a
// single JSON object. Each log event produces no more than one call to
// w.Write. The passed Writer must be safe for concurrent use by multiple
// goroutines if the returned Logger will b... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/log/doc.go | log/doc.go | // Package log provides a structured logger.
//
// Deprecated: Use github.com/go-kit/log instead.
//
// Structured logging produces logs easily consumed later by humans or
// machines. Humans might be interested in debugging errors, or tracing
// specific requests. Machines might be interested in counting interesting
/... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/log/logfmt_logger.go | log/logfmt_logger.go | package log
import (
"io"
"github.com/go-kit/log"
)
// NewLogfmtLogger returns a logger that encodes keyvals to the Writer in
// logfmt format. Each log event produces no more than one call to w.Write.
// The passed Writer must be safe for concurrent use by multiple goroutines if
// the returned Logger will be use... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/log/logrus/logrus_logger_test.go | log/logrus/logrus_logger_test.go | package logrus_test
import (
"bytes"
"encoding/json"
"errors"
"strings"
"testing"
log "github.com/go-kit/kit/log/logrus"
"github.com/sirupsen/logrus"
)
func TestLogrusLogger(t *testing.T) {
t.Parallel()
buf := &bytes.Buffer{}
logrusLogger := logrus.New()
logrusLogger.Out = buf
logrusLogger.Formatter = &l... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/log/logrus/logrus_logger.go | log/logrus/logrus_logger.go | // Package logrus provides an adapter to the
// go-kit log.Logger interface.
package logrus
import (
"errors"
"fmt"
"github.com/go-kit/log"
"github.com/sirupsen/logrus"
)
type Logger struct {
field logrus.FieldLogger
level logrus.Level
}
type Option func(*Logger)
var errMissingValue = errors.New("(MISSING)")... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/log/term/colorwriter.go | log/term/colorwriter.go | package term
import (
"io"
"github.com/go-kit/log/term"
)
// NewColorWriter returns an io.Writer that writes to w and provides cross
// platform support for ANSI color codes. If w is not a terminal it is
// returned unmodified.
func NewColorWriter(w io.Writer) io.Writer {
return term.NewColorWriter(w)
}
| go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/log/term/example_test.go | log/term/example_test.go | package term_test
import (
"errors"
"os"
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/term"
)
func ExampleNewLogger_redErrors() {
// Color errors red
colorFn := func(keyvals ...interface{}) term.FgBgColor {
for i := 1; i < len(keyvals); i += 2 {
if _, ok := keyvals[i].(error); ok {
return te... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/log/term/term.go | log/term/term.go | // Package term provides tools for logging to a terminal.
//
// Deprecated: Use github.com/go-kit/log/term instead.
package term
import (
"io"
"github.com/go-kit/log"
"github.com/go-kit/log/term"
)
// NewLogger returns a Logger that takes advantage of terminal features if
// possible. Log events are formatted by ... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/log/term/colorlogger.go | log/term/colorlogger.go | package term
import (
"io"
"github.com/go-kit/log"
"github.com/go-kit/log/term"
)
// Color represents an ANSI color. The zero value is Default.
type Color = term.Color
// ANSI colors.
const (
Default = term.Default
Black = term.Black
DarkRed = term.DarkRed
DarkGreen = term.DarkGreen
Brown ... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/log/deprecated_levels/levels.go | log/deprecated_levels/levels.go | // Package levels implements leveled logging on top of Go kit's log package.
//
// Deprecated: Use github.com/go-kit/log/level instead.
package levels
import "github.com/go-kit/log"
// Levels provides a leveled logging wrapper around a logger. It has five
// levels: debug, info, warning (warn), error, and critical (c... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/log/deprecated_levels/levels_test.go | log/deprecated_levels/levels_test.go | package levels_test
import (
"bytes"
"os"
"testing"
levels "github.com/go-kit/kit/log/deprecated_levels"
"github.com/go-kit/log"
)
func TestDefaultLevels(t *testing.T) {
buf := bytes.Buffer{}
logger := levels.New(log.NewLogfmtLogger(&buf))
logger.Debug().Log("msg", "résumé") // of course you'd want to do th... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/log/level/level.go | log/level/level.go | package level
import (
"github.com/go-kit/log"
"github.com/go-kit/log/level"
)
// Error returns a logger that includes a Key/ErrorValue pair.
func Error(logger log.Logger) log.Logger {
return level.Error(logger)
}
// Warn returns a logger that includes a Key/WarnValue pair.
func Warn(logger log.Logger) log.Logger... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/log/level/example_test.go | log/level/example_test.go | package level_test
import (
"errors"
"os"
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
)
func Example_basic() {
logger := log.NewLogfmtLogger(os.Stdout)
level.Debug(logger).Log("msg", "this message is at the debug level")
level.Info(logger).Log("msg", "this message is at the info level")
lev... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/log/level/doc.go | log/level/doc.go | // Package level implements leveled logging on top of Go kit's log package.
//
// Deprecated: Use github.com/go-kit/log/level instead.
//
// To use the level package, create a logger as per normal in your func main,
// and wrap it with level.NewFilter.
//
// var logger log.Logger
// logger = log.NewLogfmtLogger(o... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/log/zap/zap_sugar_logger_test.go | log/zap/zap_sugar_logger_test.go | package zap_test
import (
"encoding/json"
kitzap "github.com/go-kit/kit/log/zap"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"strings"
"testing"
)
func TestZapSugarLogger(t *testing.T) {
// logger config
encoderConfig := zap.NewDevelopmentEncoderConfig()
encoder := zapcore.NewJSONEncoder(encoderConfig)
leve... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/log/zap/zap_sugar_logger.go | log/zap/zap_sugar_logger.go | package zap
import (
"github.com/go-kit/log"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
type zapSugarLogger func(msg string, keysAndValues ...interface{})
func (l zapSugarLogger) Log(kv ...interface{}) error {
l("", kv...)
return nil
}
// NewZapSugarLogger returns a Go kit log.Logger that sends
// log event... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/log/syslog/syslog.go | log/syslog/syslog.go | //go:build !windows && !plan9 && !nacl
// +build !windows,!plan9,!nacl
// Deprecated: Use github.com/go-kit/log/syslog instead.
package syslog
import (
"io"
"github.com/go-kit/log"
"github.com/go-kit/log/syslog"
)
// SyslogWriter is an interface wrapping stdlib syslog Writer.
type SyslogWriter = syslog.SyslogWri... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/log/syslog/example_test.go | log/syslog/example_test.go | // +build !windows
// +build !plan9
// +build !nacl
package syslog_test
import (
"fmt"
gosyslog "log/syslog"
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/go-kit/kit/log/syslog"
)
func ExampleNewSyslogLogger_defaultPrioritySelector() {
// Normal syslog writer
w, err := gosyslog.N... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/endpoint/endpoint_example_test.go | endpoint/endpoint_example_test.go | package endpoint_test
import (
"context"
"fmt"
"github.com/go-kit/kit/endpoint"
)
func ExampleChain() {
e := endpoint.Chain(
annotate("first"),
annotate("second"),
annotate("third"),
)(myEndpoint)
if _, err := e(ctx, req); err != nil {
panic(err)
}
// Output:
// first pre
// second pre
// third ... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/endpoint/endpoint.go | endpoint/endpoint.go | package endpoint
import (
"context"
)
// Endpoint is the fundamental building block of servers and clients.
// It represents a single RPC method.
type Endpoint func(ctx context.Context, request interface{}) (response interface{}, err error)
// Nop is an endpoint that does nothing and returns a nil error.
// Useful ... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/endpoint/doc.go | endpoint/doc.go | // Package endpoint defines an abstraction for RPCs.
//
// Endpoints are a fundamental building block for many Go kit components.
// Endpoints are implemented by servers, and called by clients.
package endpoint
| go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/ratelimit/token_bucket_test.go | ratelimit/token_bucket_test.go | package ratelimit_test
import (
"context"
"strings"
"testing"
"time"
"golang.org/x/time/rate"
"github.com/go-kit/kit/endpoint"
"github.com/go-kit/kit/ratelimit"
)
var nopEndpoint = func(context.Context, interface{}) (interface{}, error) { return struct{}{}, nil }
func TestXRateErroring(t *testing.T) {
limi... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
go-kit/kit | https://github.com/go-kit/kit/blob/78fbbceece7bbcf073bee814a7772f4397ea756c/ratelimit/token_bucket.go | ratelimit/token_bucket.go | package ratelimit
import (
"context"
"errors"
"github.com/go-kit/kit/endpoint"
)
// ErrLimited is returned in the request path when the rate limiter is
// triggered and the request is rejected.
var ErrLimited = errors.New("rate limit exceeded")
// Allower dictates whether or not a request is acceptable to run.
/... | go | MIT | 78fbbceece7bbcf073bee814a7772f4397ea756c | 2026-01-07T08:37:16.912292Z | false |
tmrts/go-patterns | https://github.com/tmrts/go-patterns/blob/f978e420361704bd7531e2b57905a308a3a012c8/structural/proxy/main.go | structural/proxy/main.go | package main
import (
"fmt"
)
// For example:
// we must a execute some command
// so before that we must to create new terminal session
// and provide our user name and command
func main() {
// Create new instance of Proxy terminal
t, err := NewTerminal("gopher")
if err != nil {
// panic: User cant be empty
... | go | Apache-2.0 | f978e420361704bd7531e2b57905a308a3a012c8 | 2026-01-07T08:37:20.708268Z | false |
tmrts/go-patterns | https://github.com/tmrts/go-patterns/blob/f978e420361704bd7531e2b57905a308a3a012c8/behavioral/observer/main.go | behavioral/observer/main.go | // Package main serves as an example application that makes use of the observer pattern.
// Playground: https://play.golang.org/p/cr8jEmDmw0
package main
import (
"fmt"
"time"
)
type (
// Event defines an indication of a point-in-time occurrence.
Event struct {
// Data in this case is a simple int, but the actu... | go | Apache-2.0 | f978e420361704bd7531e2b57905a308a3a012c8 | 2026-01-07T08:37:20.708268Z | false |
tmrts/go-patterns | https://github.com/tmrts/go-patterns/blob/f978e420361704bd7531e2b57905a308a3a012c8/concurrency/parallelism.go | concurrency/parallelism.go | package parallelism
import (
"crypto/md5"
"errors"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"sort"
"sync"
)
// A result is the product of reading and summing a file using MD5.
type result struct {
path string
sum [md5.Size]byte
err error
}
// sumFiles starts goroutines to walk the directory tree at root a... | go | Apache-2.0 | f978e420361704bd7531e2b57905a308a3a012c8 | 2026-01-07T08:37:20.708268Z | false |
tmrts/go-patterns | https://github.com/tmrts/go-patterns/blob/f978e420361704bd7531e2b57905a308a3a012c8/concurrency/bounded_parallelism.go | concurrency/bounded_parallelism.go | package bounded_parallelism
import (
"crypto/md5"
"errors"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"sort"
"sync"
)
// walkFiles starts a goroutine to walk the directory tree at root and send the
// path of each regular file on the string channel. It sends the result of the
// walk on the error channel. If do... | go | Apache-2.0 | f978e420361704bd7531e2b57905a308a3a012c8 | 2026-01-07T08:37:20.708268Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/pkg/highlight/parser.go | pkg/highlight/parser.go | package highlight
import (
"bytes"
"errors"
"fmt"
"regexp"
"gopkg.in/yaml.v2"
)
// A Group represents a syntax group
type Group uint8
// Groups contains all of the groups that are defined
// You can access them in the map via their string name
var Groups map[string]Group
var numGroups Group
// String returns ... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/pkg/highlight/unicode.go | pkg/highlight/unicode.go | package highlight
import (
"unicode"
"unicode/utf8"
)
var minMark = rune(unicode.Mark.R16[0].Lo)
func isMark(r rune) bool {
// Fast path
if r < minMark {
return false
}
return unicode.In(r, unicode.Mark)
}
// DecodeCharacter returns the next character from an array of bytes
// A character is a rune along wi... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/pkg/highlight/highlighter.go | pkg/highlight/highlighter.go | package highlight
import (
"regexp"
"strings"
)
func sliceStart(slc []byte, index int) []byte {
len := len(slc)
i := 0
totalSize := 0
for totalSize < len {
if i >= index {
return slc[totalSize:]
}
_, _, size := DecodeCharacter(slc[totalSize:])
totalSize += size
i++
}
return slc[totalSize:]
}
f... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/cmd/micro/clean.go | cmd/micro/clean.go | package main
import (
"bufio"
"encoding/gob"
"errors"
"fmt"
"os"
"path/filepath"
"sort"
"strings"
"github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/config"
"github.com/zyedidia/micro/v2/internal/util"
)
func shouldContinue() bool {
reader := bufio.NewReader(os.Stdin)
... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/cmd/micro/debug.go | cmd/micro/debug.go | package main
import (
"log"
"os"
"github.com/zyedidia/micro/v2/internal/util"
)
// NullWriter simply sends writes into the void
type NullWriter struct{}
// Write is empty
func (NullWriter) Write(data []byte) (n int, err error) {
return 0, nil
}
// InitLog sets up the debug log system for micro if it has been e... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/cmd/micro/initlua.go | cmd/micro/initlua.go | package main
import (
"log"
"time"
lua "github.com/yuin/gopher-lua"
luar "layeh.com/gopher-luar"
"github.com/zyedidia/micro/v2/internal/action"
"github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/config"
"github.com/zyedidia/micro/v2/internal/display"
ulua "github.com/zyedi... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/cmd/micro/micro_test.go | cmd/micro/micro_test.go | package main
import (
"fmt"
"log"
"os"
"testing"
"github.com/go-errors/errors"
"github.com/micro-editor/tcell/v2"
"github.com/stretchr/testify/assert"
"github.com/zyedidia/micro/v2/internal/action"
"github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/config"
"github.com/zye... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/cmd/micro/micro.go | cmd/micro/micro.go | package main
import (
"flag"
"fmt"
"io"
"log"
"os"
"os/signal"
"path/filepath"
"regexp"
"runtime"
"runtime/pprof"
"sort"
"strconv"
"syscall"
"time"
"github.com/go-errors/errors"
isatty "github.com/mattn/go-isatty"
"github.com/micro-editor/tcell/v2"
lua "github.com/yuin/gopher-lua"
"github.com/zyedi... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/tools/remove-nightly-assets.go | tools/remove-nightly-assets.go | //go:build ignore
package main
import (
"fmt"
"io"
"net/http"
"os/exec"
"strings"
"github.com/micro-editor/json5"
)
func main() {
resp, err := http.Get("https://api.github.com/repos/zyedidia/micro/releases")
if err != nil {
fmt.Println(err.Error())
return
}
defer resp.Body.Close()
body, err := io.Rea... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/tools/build-date.go | tools/build-date.go | //go:build ignore
package main
import (
"fmt"
"os"
"strconv"
"time"
)
func main() {
var buildTime time.Time
epoch := os.Getenv("SOURCE_DATE_EPOCH")
if epoch != "" {
i, err := strconv.Atoi(epoch)
if err != nil {
fmt.Errorf("SOURCE_DATE_EPOCH is not a valid integer")
os.Exit(1)
}
buildTime = time.... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/tools/testgen.go | tools/testgen.go | //go:build ignore
package main
import (
"fmt"
"log"
"os"
"regexp"
"strings"
"github.com/robertkrimen/otto/ast"
"github.com/robertkrimen/otto/parser"
)
type walker struct {
nodes []ast.Node
}
func (w *walker) Enter(node ast.Node) ast.Visitor {
w.nodes = append(w.nodes, node)
return w
}
func (w *walker) E... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/tools/info-plist.go | tools/info-plist.go | //go:build ignore
package main
import (
"fmt"
"os"
"runtime"
)
func main() {
if runtime.GOOS != "darwin" {
return
}
if len(os.Args) != 3 {
panic("missing arguments")
}
if os.Args[1] != "darwin" {
return
}
rawInfoPlist := `<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD P... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/tools/build-version.go | tools/build-version.go | //go:build ignore
package main
import (
"fmt"
"log"
"os/exec"
"strings"
"github.com/blang/semver"
)
func getTag(match ...string) (string, *semver.PRVersion) {
args := append([]string{
"describe", "--tags",
}, match...)
if tag, err := exec.Command("git", args...).Output(); err != nil {
return "", nil
} ... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/runtime/runtime_test.go | runtime/runtime_test.go | package config
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestAssetDir(t *testing.T) {
t.Parallel()
// Test AssetDir
entries, err := AssetDir("syntax")
assert.NoError(t, err)
assert.Contains(t, entries, "go.yaml")
assert.True(t, len(entries) > 5)
}
| go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/runtime/runtime.go | runtime/runtime.go | package config
import (
"embed"
"path/filepath"
"strings"
)
//go:generate go run syntax/make_headers.go syntax
//go:embed colorschemes help plugins syntax
var runtime embed.FS
func fixPath(name string) string {
return strings.TrimLeft(filepath.ToSlash(name), "runtime/")
}
// AssetDir lists file names in folder... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/runtime/syntax/syntax_converter.go | runtime/syntax/syntax_converter.go | //go:build ignore
package main
import (
"fmt"
"os"
"regexp"
"strings"
)
type SingleRule struct {
color string
regex string
}
type MultiRule struct {
color string
start string
end string
}
// JoinRule takes a syntax rule (which can be multiple regular expressions)
// and joins it into one regular express... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/runtime/syntax/make_headers.go | runtime/syntax/make_headers.go | //go:build ignore
// +build ignore
package main
import (
"bytes"
"fmt"
"os"
"strings"
"time"
yaml "gopkg.in/yaml.v2"
)
type HeaderYaml struct {
FileType string `yaml:"filetype"`
Detect struct {
FNameRgx string `yaml:"filename"`
HeaderRgx string `yaml:"header"`
SignatureRgx string `yaml:"signa... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/util/profile.go | internal/util/profile.go | package util
import (
"fmt"
"log"
"runtime"
"time"
humanize "github.com/dustin/go-humanize"
)
// GetMemStats returns a string describing the memory usage and gc time used so far
func GetMemStats() string {
var memstats runtime.MemStats
runtime.ReadMemStats(&memstats)
return fmt.Sprintf("Alloc: %s, Sys: %s, G... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/util/util.go | internal/util/util.go | package util
import (
"archive/zip"
"bytes"
"crypto/md5"
"errors"
"fmt"
"io"
"io/fs"
"net/http"
"net/url"
"os"
"os/user"
"path/filepath"
"regexp"
"runtime"
"strconv"
"strings"
"time"
"unicode"
"unicode/utf8"
"github.com/blang/semver"
runewidth "github.com/mattn/go-runewidth"
)
var (
// These va... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/util/unicode.go | internal/util/unicode.go | package util
import (
"unicode"
"unicode/utf8"
)
// Unicode is annoying. A "code point" (rune in Go-speak) may need up to
// 4 bytes to represent it. In general, a code point will represent a
// complete character, but this is not always the case. A character with
// accents may be made up of multiple code points (... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/util/lua.go | internal/util/lua.go | package util
// LuaRuneAt is a helper function for lua plugins to return the rune
// at an index within a string
func LuaRuneAt(str string, runeidx int) string {
i := 0
for len(str) > 0 {
r, _, size := DecodeCharacterInString(str)
str = str[size:]
if i == runeidx {
return string(r)
}
i++
}
return "... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/util/util_test.go | internal/util/util_test.go | package util
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestStringWidth(t *testing.T) {
bytes := []byte("\tPot să \tmănânc sticlă și ea nu mă rănește.")
n := StringWidth(bytes, 23, 4)
assert.Equal(t, 26, n)
}
func TestSliceVisualEnd(t *testing.T) {
s := []byte("\thello")
slc, n, _ := Sli... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/screen/screen.go | internal/screen/screen.go | package screen
import (
"errors"
"log"
"os"
"sync"
"github.com/micro-editor/tcell/v2"
"github.com/zyedidia/micro/v2/internal/config"
"github.com/zyedidia/micro/v2/internal/util"
)
// Screen is the tcell screen we use to draw to the terminal
// Synchronization is used because we poll the screen on a separate
/... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/screen/message.go | internal/screen/message.go | package screen
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
// TermMessage sends a message to the user in the terminal. This usually occurs before
// micro has been fully initialized -- ie if there is an error in the syntax highlighting
// regular expressions
// The function must be called when the Screen i... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/display/termwindow.go | internal/display/termwindow.go | package display
import (
"github.com/micro-editor/tcell/v2"
"github.com/micro-editor/terminal"
"github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/config"
"github.com/zyedidia/micro/v2/internal/screen"
"github.com/zyedidia/micro/v2/internal/shell"
"github.com/zyedidia/micro/v2/... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/display/window.go | internal/display/window.go | package display
import (
"github.com/zyedidia/micro/v2/internal/buffer"
)
type View struct {
X, Y int // X,Y location of the view
Width, Height int // Width and height of the view
// Start line of the view (for vertical scroll)
StartLine SLoc
// Start column of the view (for horizontal scroll)
// no... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/display/infowindow.go | internal/display/infowindow.go | package display
import (
runewidth "github.com/mattn/go-runewidth"
"github.com/micro-editor/tcell/v2"
"github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/config"
"github.com/zyedidia/micro/v2/internal/info"
"github.com/zyedidia/micro/v2/internal/screen"
"github.com/zyedidia/mic... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/display/uiwindow.go | internal/display/uiwindow.go | package display
import (
"github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/config"
"github.com/zyedidia/micro/v2/internal/screen"
"github.com/zyedidia/micro/v2/internal/util"
"github.com/zyedidia/micro/v2/internal/views"
)
type UIWindow struct {
root *views.Node
}
func NewUI... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/display/statusline.go | internal/display/statusline.go | package display
import (
"bytes"
"fmt"
"regexp"
"strconv"
"strings"
luar "layeh.com/gopher-luar"
runewidth "github.com/mattn/go-runewidth"
lua "github.com/yuin/gopher-lua"
"github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/config"
ulua "github.com/zyedidia/micro/v2/inter... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/display/bufwindow.go | internal/display/bufwindow.go | package display
import (
"strconv"
"strings"
runewidth "github.com/mattn/go-runewidth"
"github.com/micro-editor/tcell/v2"
"github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/config"
"github.com/zyedidia/micro/v2/internal/screen"
"github.com/zyedidia/micro/v2/internal/util"
)
... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/display/softwrap.go | internal/display/softwrap.go | package display
import (
runewidth "github.com/mattn/go-runewidth"
"github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/util"
)
// SLoc represents a vertical scrolling location, i.e. a location of a visual line
// in the buffer. When softwrap is enabled, a buffer line may be displa... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/display/tabwindow.go | internal/display/tabwindow.go | package display
import (
runewidth "github.com/mattn/go-runewidth"
"github.com/micro-editor/tcell/v2"
"github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/config"
"github.com/zyedidia/micro/v2/internal/screen"
"github.com/zyedidia/micro/v2/internal/util"
)
type TabWindow struct ... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/action/terminal_supported.go | internal/action/terminal_supported.go | //go:build linux || darwin || dragonfly || solaris || openbsd || netbsd || freebsd
package action
import (
shellquote "github.com/kballard/go-shellquote"
"github.com/zyedidia/micro/v2/internal/shell"
)
// TermEmuSupported is a constant that marks if the terminal emulator is supported
const TermEmuSupported = true
... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/action/actions.go | internal/action/actions.go | package action
import (
"errors"
"fmt"
"io/fs"
"os"
"regexp"
"runtime"
"strings"
"time"
shellquote "github.com/kballard/go-shellquote"
"github.com/micro-editor/tcell/v2"
"github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/clipboard"
"github.com/zyedidia/micro/v2/internal... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | true |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/action/globals.go | internal/action/globals.go | package action
import "github.com/zyedidia/micro/v2/internal/buffer"
// InfoBar is the global info bar.
var InfoBar *InfoPane
// LogBufPane is a global log buffer.
var LogBufPane *BufPane
// InitGlobals initializes the log buffer and the info bar
func InitGlobals() {
InfoBar = NewInfoBar()
buffer.LogBuf = buffer.... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/action/bindings.go | internal/action/bindings.go | package action
import (
"encoding/json"
"errors"
"fmt"
"io/fs"
"os"
"path/filepath"
"regexp"
"strings"
"unicode"
"github.com/micro-editor/json5"
"github.com/micro-editor/tcell/v2"
"github.com/zyedidia/micro/v2/internal/config"
"github.com/zyedidia/micro/v2/internal/screen"
"github.com/zyedidia/micro/v2/... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/action/keytree.go | internal/action/keytree.go | package action
import (
"bytes"
"github.com/micro-editor/tcell/v2"
)
type PaneKeyAction func(Pane) bool
type PaneMouseAction func(Pane, *tcell.EventMouse) bool
type PaneKeyAnyAction func(Pane, []KeyEvent) bool
// A KeyTreeNode stores a single node in the KeyTree (trie). The
// children are stored as a map, and an... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/action/rawpane.go | internal/action/rawpane.go | package action
import (
"fmt"
"reflect"
"github.com/micro-editor/tcell/v2"
"github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/display"
)
type RawPane struct {
*BufPane
}
func NewRawPaneFromWin(b *buffer.Buffer, win display.BWindow, tab *Tab) *RawPane {
rh := new(RawPane)
r... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/action/actions_posix.go | internal/action/actions_posix.go | //go:build linux || darwin || dragonfly || solaris || openbsd || netbsd || freebsd
package action
import (
"syscall"
"github.com/zyedidia/micro/v2/internal/screen"
)
// Suspend sends micro to the background. This is the same as pressing CtrlZ in most unix programs.
// This only works on linux and has no default b... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/action/infopane.go | internal/action/infopane.go | package action
import (
"bytes"
"github.com/micro-editor/tcell/v2"
"github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/config"
"github.com/zyedidia/micro/v2/internal/display"
"github.com/zyedidia/micro/v2/internal/info"
"github.com/zyedidia/micro/v2/internal/util"
)
type Info... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/action/termpane.go | internal/action/termpane.go | package action
import (
"errors"
"runtime"
"github.com/micro-editor/tcell/v2"
"github.com/micro-editor/terminal"
"github.com/zyedidia/micro/v2/internal/clipboard"
"github.com/zyedidia/micro/v2/internal/config"
"github.com/zyedidia/micro/v2/internal/display"
"github.com/zyedidia/micro/v2/internal/screen"
"git... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/action/defaults.go | internal/action/defaults.go | package action
var termdefaults = map[string]string{
"<Ctrl-q><Ctrl-q>": "Exit",
"<Ctrl-e><Ctrl-e>": "CommandMode",
"<Ctrl-w><Ctrl-w>": "NextSplit|FirstSplit",
}
// DefaultBindings returns a map containing micro's default keybindings
func DefaultBindings(pane string) map[string]string {
switch pane {
case "comma... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/action/infocomplete.go | internal/action/infocomplete.go | package action
import (
"bytes"
"sort"
"strings"
"github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/config"
"github.com/zyedidia/micro/v2/internal/util"
"github.com/zyedidia/micro/v2/pkg/highlight"
)
// This file is meant (for now) for autocompletion in command mode, not
// ... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/action/terminal_unsupported.go | internal/action/terminal_unsupported.go | //go:build plan9 || nacl || windows
package action
import "errors"
// TermEmuSupported is a constant that marks if the terminal emulator is supported
const TermEmuSupported = false
// RunTermEmulator returns an error for unsupported systems (non-unix systems
func RunTermEmulator(input string, wait bool, getOutput b... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/action/defaults_other.go | internal/action/defaults_other.go | //go:build !darwin
// +build !darwin
package action
var bufdefaults = map[string]string{
"Up": "CursorUp",
"Down": "CursorDown",
"Right": "CursorRight",
"Left": "CursorLeft",
"ShiftUp": "SelectUp",
"ShiftDown": "SelectDown",
"ShiftLeft": "SelectLeft",
... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/action/defaults_darwin.go | internal/action/defaults_darwin.go | package action
var bufdefaults = map[string]string{
"Up": "CursorUp",
"Down": "CursorDown",
"Right": "CursorRight",
"Left": "CursorLeft",
"ShiftUp": "SelectUp",
"ShiftDown": "SelectDown",
"ShiftLeft": "SelectLeft",
"ShiftRight": "SelectRight",
"Alt... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/action/command.go | internal/action/command.go | package action
import (
"bytes"
"errors"
"fmt"
"os"
"os/exec"
"path/filepath"
"reflect"
"regexp"
"strconv"
"strings"
shellquote "github.com/kballard/go-shellquote"
"github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/clipboard"
"github.com/zyedidia/micro/v2/internal/conf... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/action/events.go | internal/action/events.go | package action
import (
"bytes"
"errors"
"fmt"
"strings"
"github.com/micro-editor/tcell/v2"
)
type Event interface {
Name() string
}
// RawEvent is simply an escape code
// We allow users to directly bind escape codes
// to get around some of a limitations of terminals
type RawEvent struct {
esc string
}
fu... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/action/pane.go | internal/action/pane.go | package action
import (
"github.com/zyedidia/micro/v2/internal/display"
)
// A Pane is a general interface for a window in the editor.
type Pane interface {
Handler
display.Window
ID() uint64
SetID(i uint64)
Name() string
Close()
SetTab(t *Tab)
Tab() *Tab
}
| go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/action/bufpane.go | internal/action/bufpane.go | package action
import (
"strings"
"time"
luar "layeh.com/gopher-luar"
"github.com/micro-editor/tcell/v2"
lua "github.com/yuin/gopher-lua"
"github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/config"
"github.com/zyedidia/micro/v2/internal/display"
ulua "github.com/zyedidia/mi... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/action/actions_other.go | internal/action/actions_other.go | //go:build plan9 || nacl || windows
package action
func (*BufPane) Suspend() bool {
InfoBar.Error("Suspend is only supported on BSD/Linux")
return false
}
| go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
zyedidia/micro | https://github.com/zyedidia/micro/blob/6a62575bcfdf4965f187eedafceb3400316e612b/internal/action/tab.go | internal/action/tab.go | package action
import (
luar "layeh.com/gopher-luar"
"github.com/micro-editor/tcell/v2"
"github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/config"
"github.com/zyedidia/micro/v2/internal/display"
ulua "github.com/zyedidia/micro/v2/internal/lua"
"github.com/zyedidia/micro/v2/in... | go | MIT | 6a62575bcfdf4965f187eedafceb3400316e612b | 2026-01-07T08:37:16.157226Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.