Skip to content

Commit

Permalink
all: deprecate wrapper packages
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rogpeppe authored and mvdan committed Mar 27, 2023
1 parent d4265f6 commit 81831f2
Show file tree
Hide file tree
Showing 28 changed files with 26 additions and 534 deletions.
6 changes: 3 additions & 3 deletions cmd/txtar-addmod/addmod.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import (
"path/filepath"
"strings"

"github.com/rogpeppe/go-internal/module"
"github.com/rogpeppe/go-internal/txtar"
"golang.org/x/mod/module"
"golang.org/x/tools/txtar"
)

func usage() {
Expand Down Expand Up @@ -123,7 +123,7 @@ func main1() int {
}
path, vers, dir := f[0], f[1], f[2]

encpath, err := module.EncodePath(path)
encpath, err := module.EscapePath(path)
if err != nil {
log.Printf("failed to encode path %q: %v", path, err)
continue
Expand Down
2 changes: 1 addition & 1 deletion cmd/txtar-c/savedir.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//
// txtar-c /path/to/dir >saved.txtar
//
// See https://godoc.org/github.com/rogpeppe/go-internal/txtar for details of the format
// See https://godoc.org/golang.org/x/tools/txtar for details of the format
// and how to parse a txtar file.
package main

Expand Down
2 changes: 1 addition & 1 deletion cmd/txtar-x/extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//
// txtar-x [-C root-dir] saved.txt
//
// See https://godoc.org/github.com/rogpeppe/go-internal/txtar for details of the format
// See https://godoc.org/golang.org/x/tools/txtar for details of the format
// and how to parse a txtar file.
package main

Expand Down
2 changes: 1 addition & 1 deletion diff/diff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"path/filepath"
"testing"

"github.com/rogpeppe/go-internal/txtar"
"golang.org/x/tools/txtar"
)

func clean(text []byte) []byte {
Expand Down
19 changes: 10 additions & 9 deletions goproxytest/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ import (
"path/filepath"
"strings"

"github.com/rogpeppe/go-internal/module"
"golang.org/x/mod/module"
"golang.org/x/mod/semver"
"golang.org/x/tools/txtar"

"github.com/rogpeppe/go-internal/par"
"github.com/rogpeppe/go-internal/semver"
"github.com/rogpeppe/go-internal/txtar"
)

type Server struct {
Expand Down Expand Up @@ -110,12 +111,12 @@ func (srv *Server) readModList() error {
continue
}
encPath := strings.Replace(name[:i], "_", "/", -1)
path, err := module.DecodePath(encPath)
path, err := module.UnescapePath(encPath)
if err != nil {
return fmt.Errorf("cannot decode module path in %q: %v", name, err)
}
encVers := name[i+1:]
vers, err := module.DecodeVersion(encVers)
vers, err := module.UnescapeVersion(encVers)
if err != nil {
return fmt.Errorf("cannot decode module version in %q: %v", name, err)
}
Expand All @@ -138,7 +139,7 @@ func (srv *Server) handler(w http.ResponseWriter, r *http.Request) {
return
}
enc, file := path[:i], path[i+len("/@v/"):]
path, err := module.DecodePath(enc)
path, err := module.UnescapePath(enc)
if err != nil {
fmt.Fprintf(os.Stderr, "go proxy_test: %v\n", err)
http.NotFound(w, r)
Expand Down Expand Up @@ -166,7 +167,7 @@ func (srv *Server) handler(w http.ResponseWriter, r *http.Request) {
return
}
encVers, ext := file[:i], file[i+1:]
vers, err := module.DecodeVersion(encVers)
vers, err := module.UnescapeVersion(encVers)
if err != nil {
fmt.Fprintf(os.Stderr, "go proxy_test: %v\n", err)
http.NotFound(w, r)
Expand Down Expand Up @@ -274,12 +275,12 @@ func (srv *Server) findHash(m module.Version) string {
}

func (srv *Server) readArchive(path, vers string) *txtar.Archive {
enc, err := module.EncodePath(path)
enc, err := module.EscapePath(path)
if err != nil {
fmt.Fprintf(os.Stderr, "go proxy: %v\n", err)
return nil
}
encVers, err := module.EncodeVersion(vers)
encVers, err := module.EscapeVersion(vers)
if err != nil {
fmt.Fprintf(os.Stderr, "go proxy: %v\n", err)
return nil
Expand Down
2 changes: 1 addition & 1 deletion goproxytest/pseudo.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"regexp"
"strings"

"github.com/rogpeppe/go-internal/semver"
"golang.org/x/mod/semver"
)

// This code was taken from cmd/go/internal/modfetch/pseudo.go
Expand Down
2 changes: 2 additions & 0 deletions modfile/forward.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
// apart from the ParseGopkgIn function which doesn't exist there.
//
// See that package for documentation.
//
// Deprecated: use [golang.org/x/mod/modfile] instead.
package modfile

import (
Expand Down
203 changes: 0 additions & 203 deletions modfile/read_test.go

This file was deleted.

0 comments on commit 81831f2

Please sign in to comment.