x-tools-internal

command module
v0.0.0-...-d3edee4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 21, 2023 License: BSD-3-Clause Imports: 4 Imported by: 0

README

What?

This package exposes some internal packages from golang.org/x/tools/internal, by simply copying them.

How?

Note: This section explains how this package is created, not how it should be used by the calling code.

Here we've exposed the following packages from golang.org/x/tools/internal: bug, diff, event, fakenet, fuzzy, gocommand, goroot, jsonrpc2, jsonrpc2_v2, memoize, persistent, stack, testenv and xcontext.

Here's how we've done this:

  • First we've copied all these packages from the original source to this repo.
  • After that we've adjusted import statements by replacing golang.org/x/tools/internal/<package_name> with github.com/peske/x-tools-internal/<package_name> for all the imported packages.

This is done automatically, by using copy tool. To use the tool you first need to build it:

go build .

This will create x-tools-internal executable file in the working directory. After that you can use the copy tool in the following way:

./x-tools-internal /path/to/golang.org/x/tools

The CLI argument provided represents the local path of golang.org/x/tools module. The argument is optional, and if not provided it will default to $GOHOME/src/golang.org/x/tools.

Assuming that the source module is located at its default location ($GOHOME/src/golang.org/x/tools), previous two steps can be replaced by simply executing go generate, since the main.go file contains the following lines:

//go:generate go build .
//go:generate ./x-tools-internal

Why?

The original packages are used in some other golang.org/x/tools packages that we want to rewrite, but we cannot use them directly because they are internal. For example, these packages are used in peske/lsp-srv package.

License?

The same license as the original one - BSD-3-Clause license. Although almost all the code is created by the authors of the original module (The Go Authors), we've changed copyright here to Fat Dragon and authors not to get the credits, but to protect the original authors of any responsibility if there are any problems in the code that we've changed. All credits should go to the authors of the original module.

Version?

Current main branch is based on the original repository commit 6deeacb from April 20, 2023.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package bug provides utilities for reporting internal bugs, and being notified when they occur.
Package bug provides utilities for reporting internal bugs, and being notified when they occur.
Package diff computes differences between text files or strings.
Package diff computes differences between text files or strings.
difftest
Package difftest supplies a set of tests that will operate on any implementation of a diff algorithm as exposed by "github.com/peske/x-tools-internal/diff"
Package difftest supplies a set of tests that will operate on any implementation of a diff algorithm as exposed by "github.com/peske/x-tools-internal/diff"
lcs
package lcs contains code to find longest-common-subsequences (and diffs)
package lcs contains code to find longest-common-subsequences (and diffs)
myers
Package myers implements the Myers diff algorithm.
Package myers implements the Myers diff algorithm.
Package event provides a set of packages that cover the main concepts of telemetry in an implementation agnostic way.
Package event provides a set of packages that cover the main concepts of telemetry in an implementation agnostic way.
core
Package core provides support for event based telemetry.
Package core provides support for event based telemetry.
export/eventtest
Package eventtest supports logging events to a test.
Package eventtest supports logging events to a test.
export/metric
Package metric aggregates events into metrics that can be exported.
Package metric aggregates events into metrics that can be exported.
export/ocagent
Package ocagent adds the ability to export all telemetry to an ocagent.
Package ocagent adds the ability to export all telemetry to an ocagent.
tag
Package tag provides the labels used for telemetry throughout gopls.
Package tag provides the labels used for telemetry throughout gopls.
Package fuzzy implements a fuzzy matching algorithm.
Package fuzzy implements a fuzzy matching algorithm.
Package gocommand is a helper for calling the go command.
Package gocommand is a helper for calling the go command.
Package goroot is a copy of package internal/goroot in the main GO repot.
Package goroot is a copy of package internal/goroot in the main GO repot.
Package jsonrpc2 is a minimal implementation of the JSON RPC 2 spec.
Package jsonrpc2 is a minimal implementation of the JSON RPC 2 spec.
servertest
Package servertest provides utilities for running tests against a remote LSP server.
Package servertest provides utilities for running tests against a remote LSP server.
Package jsonrpc2 is a minimal implementation of the JSON RPC 2 spec.
Package jsonrpc2 is a minimal implementation of the JSON RPC 2 spec.
Package memoize defines a "promise" abstraction that enables memoization of the result of calling an expensive but idempotent function.
Package memoize defines a "promise" abstraction that enables memoization of the result of calling an expensive but idempotent function.
The persistent package defines various persistent data structures; that is, data structures that can be efficiently copied and modified in sublinear time.
The persistent package defines various persistent data structures; that is, data structures that can be efficiently copied and modified in sublinear time.
Package stack provides support for parsing standard goroutine stack traces.
Package stack provides support for parsing standard goroutine stack traces.
gostacks
The gostacks command processes stdin looking for things that look like stack traces and simplifying them to make the log more readable.
The gostacks command processes stdin looking for things that look like stack traces and simplifying them to make the log more readable.
Package testenv contains helper functions for skipping tests based on which tools are present in the environment.
Package testenv contains helper functions for skipping tests based on which tools are present in the environment.
Package xcontext is a package to offer the extra functionality we need from contexts that is not available from the standard context package.
Package xcontext is a package to offer the extra functionality we need from contexts that is not available from the standard context package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL