# Packages
# 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 replacinggolang.org/x/tools/internal/<package_name>
withgithub.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.