code: func PackageFor(source string) (*Package, error) {
  	w, err := WorkspaceFor(source)
  	if err != nil {
  		return nil, err
  	}
  	basepath := filepath.Join(w.Path, "src") // GOPATH mode.
  	if w.isModuleMode {
  		basepath = w.Path // Module mode.
  	}
  	path, err := filepath.Rel(basepath, filepath.Dir(source))
  	if err != nil {
  		return nil, err
  	}
  	return &Package{Workspace: w, Path: filepath.ToSlash(path)}, nil
  }
docs: // PackageFor returns the package for the given source file.