Skip to content

Commit 81831f2

Browse files
rogpeppemvdan
authored andcommitted
all: deprecate wrapper packages
People should in general be using the upstream packages rather than these. Also use the upstream packages directly when possible and remove some tests that aren't testing code in this module any more.
1 parent d4265f6 commit 81831f2

File tree

28 files changed

+26
-534
lines changed

28 files changed

+26
-534
lines changed

cmd/txtar-addmod/addmod.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ import (
2828
"path/filepath"
2929
"strings"
3030

31-
"github.com/rogpeppe/go-internal/module"
32-
"github.com/rogpeppe/go-internal/txtar"
31+
"golang.org/x/mod/module"
32+
"golang.org/x/tools/txtar"
3333
)
3434

3535
func usage() {
@@ -123,7 +123,7 @@ func main1() int {
123123
}
124124
path, vers, dir := f[0], f[1], f[2]
125125

126-
encpath, err := module.EncodePath(path)
126+
encpath, err := module.EscapePath(path)
127127
if err != nil {
128128
log.Printf("failed to encode path %q: %v", path, err)
129129
continue

cmd/txtar-c/savedir.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
//
99
// txtar-c /path/to/dir >saved.txtar
1010
//
11-
// See https://godoc.org/github.com/rogpeppe/go-internal/txtar for details of the format
11+
// See https://godoc.org/golang.org/x/tools/txtar for details of the format
1212
// and how to parse a txtar file.
1313
package main
1414

cmd/txtar-x/extract.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
//
99
// txtar-x [-C root-dir] saved.txt
1010
//
11-
// See https://godoc.org/github.com/rogpeppe/go-internal/txtar for details of the format
11+
// See https://godoc.org/golang.org/x/tools/txtar for details of the format
1212
// and how to parse a txtar file.
1313
package main
1414

diff/diff_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"path/filepath"
1010
"testing"
1111

12-
"github.com/rogpeppe/go-internal/txtar"
12+
"golang.org/x/tools/txtar"
1313
)
1414

1515
func clean(text []byte) []byte {

goproxytest/proxy.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ import (
3434
"path/filepath"
3535
"strings"
3636

37-
"github.com/rogpeppe/go-internal/module"
37+
"golang.org/x/mod/module"
38+
"golang.org/x/mod/semver"
39+
"golang.org/x/tools/txtar"
40+
3841
"github.com/rogpeppe/go-internal/par"
39-
"github.com/rogpeppe/go-internal/semver"
40-
"github.com/rogpeppe/go-internal/txtar"
4142
)
4243

4344
type Server struct {
@@ -110,12 +111,12 @@ func (srv *Server) readModList() error {
110111
continue
111112
}
112113
encPath := strings.Replace(name[:i], "_", "/", -1)
113-
path, err := module.DecodePath(encPath)
114+
path, err := module.UnescapePath(encPath)
114115
if err != nil {
115116
return fmt.Errorf("cannot decode module path in %q: %v", name, err)
116117
}
117118
encVers := name[i+1:]
118-
vers, err := module.DecodeVersion(encVers)
119+
vers, err := module.UnescapeVersion(encVers)
119120
if err != nil {
120121
return fmt.Errorf("cannot decode module version in %q: %v", name, err)
121122
}
@@ -138,7 +139,7 @@ func (srv *Server) handler(w http.ResponseWriter, r *http.Request) {
138139
return
139140
}
140141
enc, file := path[:i], path[i+len("/@v/"):]
141-
path, err := module.DecodePath(enc)
142+
path, err := module.UnescapePath(enc)
142143
if err != nil {
143144
fmt.Fprintf(os.Stderr, "go proxy_test: %v\n", err)
144145
http.NotFound(w, r)
@@ -166,7 +167,7 @@ func (srv *Server) handler(w http.ResponseWriter, r *http.Request) {
166167
return
167168
}
168169
encVers, ext := file[:i], file[i+1:]
169-
vers, err := module.DecodeVersion(encVers)
170+
vers, err := module.UnescapeVersion(encVers)
170171
if err != nil {
171172
fmt.Fprintf(os.Stderr, "go proxy_test: %v\n", err)
172173
http.NotFound(w, r)
@@ -274,12 +275,12 @@ func (srv *Server) findHash(m module.Version) string {
274275
}
275276

276277
func (srv *Server) readArchive(path, vers string) *txtar.Archive {
277-
enc, err := module.EncodePath(path)
278+
enc, err := module.EscapePath(path)
278279
if err != nil {
279280
fmt.Fprintf(os.Stderr, "go proxy: %v\n", err)
280281
return nil
281282
}
282-
encVers, err := module.EncodeVersion(vers)
283+
encVers, err := module.EscapeVersion(vers)
283284
if err != nil {
284285
fmt.Fprintf(os.Stderr, "go proxy: %v\n", err)
285286
return nil

goproxytest/pseudo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"regexp"
99
"strings"
1010

11-
"github.com/rogpeppe/go-internal/semver"
11+
"golang.org/x/mod/semver"
1212
)
1313

1414
// This code was taken from cmd/go/internal/modfetch/pseudo.go

modfile/forward.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
// apart from the ParseGopkgIn function which doesn't exist there.
55
//
66
// See that package for documentation.
7+
//
8+
// Deprecated: use [golang.org/x/mod/modfile] instead.
79
package modfile
810

911
import (

modfile/read_test.go

Lines changed: 0 additions & 203 deletions
This file was deleted.

0 commit comments

Comments
 (0)