modfetch

package
v1.0.32 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

* Copyright (c) 2021 The GoPlus Authors (goplus.org). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright (c) 2021 The GoPlus Authors (goplus.org). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright (c) 2021 The GoPlus Authors (goplus.org). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var (
	GOMODCACHE = env.GOMODCACHE()
)

Functions

func CachePath

func CachePath(m module.Version, suffix string) (string, error)

func Download

func Download(m module.Version) (dir string, err error)

func DownloadArgs

func DownloadArgs(dir string, args ...string)

func DownloadDir

func DownloadDir(m module.Version) (string, error)

DownloadDir returns the directory to which m should have been downloaded. An error will be returned if the module path or version cannot be escaped. An error satisfying errors.Is(err, fs.ErrNotExist) will be returned along with the directory if the directory does not exist or if the directory is not completely populated.

func Edit

func Edit(name string) (*os.File, error)

Edit creates the named file with mode 0666 (before umask), but does not truncate existing contents.

If Edit succeeds, methods on the returned File can be used for I/O. The associated file descriptor has mode O_RDWR and the file is write-locked.

func InitArgs

func InitArgs(dir string, args ...string)

func Read

func Read(name string) ([]byte, error)

Read opens the named file and returns its contents.

func RunGoCmd

func RunGoCmd(dir string, op string, args ...string)

RunGoCmd executes `go` command tools.

func TidyArgs

func TidyArgs(dir string, args ...string)

func Transform

func Transform(name string, t func([]byte) ([]byte, error)) (err error)

Transform invokes t with the result of reading the named file, with its lock still held.

If t returns a nil error, Transform then writes the returned contents back to the file, making a best effort to preserve existing contents on error.

t must not modify the slice passed to it.

Types

type DownloadDirPartialError

type DownloadDirPartialError struct {
	Dir string
	Err error
}

DownloadDirPartialError is returned by DownloadDir if a module directory exists but was not completely populated.

DownloadDirPartialError is equivalent to fs.ErrNotExist.

func (*DownloadDirPartialError) Error

func (e *DownloadDirPartialError) Error() string

func (*DownloadDirPartialError) Is

func (e *DownloadDirPartialError) Is(err error) bool

Jump to

Keyboard shortcuts

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