Copyright 2021 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

package proxy

import 
Module represents a module version used by the proxy server.
type Module struct {
	ModulePath string
	Version    string
	Files      map[string]string
	NotCached  bool // if true, behaves like it's uncached
	zip        []byte
}
ChangePath returns a copy of m with a different module path.
func ( *Module) ( string) *Module {
	 := *
	.ModulePath = 
	return &
}
ChangeVersion returns a copy of m with a different version.
func ( *Module) ( string) *Module {
	 := *
	.Version = 
	return &
}
AddFile returns a copy of m with an additional file. It panics if the filename is already present.
func ( *Module) (,  string) *Module {
	return .setFile(, &, false)
}
DeleteFile returns a copy of m with filename removed. It panics if filename is not present.
func ( *Module) ( string) *Module {
	return .setFile(, nil, true)
}
ReplaceFile returns a copy of m with different contents for filename. It panics if filename is not present.
func ( *Module) (,  string) *Module {
	return .setFile(, &, true)
}

func ( *Module) ( string,  *string,  bool) *Module {
	,  := .Files[]
	if  && ! {
		panic(fmt.Sprintf("%s@%s does not have a file named %s", .ModulePath, .Version, ))
	}
	if ! &&  {
		panic(fmt.Sprintf("%s@%s already has a file named %s", .ModulePath, .Version, ))
	}
	 := *
	if .Files != nil {
		.Files = map[string]string{}
		for ,  := range .Files {
			.Files[] = 
		}
	}
	if  == nil {
		delete(.Files, )
	} else {
		.Files[] = *
	}
	return &