Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
Replace noContents flag with addContents flag. (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
efritz authored Feb 27, 2020
1 parent 9598e8d commit 19196e0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions cmd/lsif-go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func realMain() error {
verbose bool
projectRoot string
moduleVersion string
noContents bool
addContents bool
outFile string
)

Expand All @@ -39,7 +39,7 @@ func realMain() error {
app.Flag("verbose", "Display verbose information.").Short('v').Default("false").BoolVar(&verbose)
app.Flag("projectRoot", "Specifies the project root. Defaults to the current working directory.").Default(".").StringVar(&projectRoot)
app.Flag("moduleVersion", "Specifies the version of the module defined by this project.").StringVar(&moduleVersion)
app.Flag("noContents", "File contents will not be embedded into the dump.").Default("false").BoolVar(&noContents)
app.Flag("addContents", "File contents will be embedded into the dump.").Default("false").BoolVar(&addContents)
app.Flag("out", "The output file the dump is saved to.").Default("dump.lsif").StringVar(&outFile)

_, err := app.Parse(os.Args[1:])
Expand Down Expand Up @@ -92,7 +92,7 @@ func realMain() error {
moduleName,
moduleVersion,
dependencies,
noContents,
addContents,
printProgressDots,
toolInfo,
out,
Expand Down
4 changes: 2 additions & 2 deletions internal/index/indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func NewIndexer(
moduleName string,
moduleVersion string,
dependencies map[string]string,
excludeContent bool,
addContents bool,
printProgressDots bool,
toolInfo protocol.ToolInfo,
w io.Writer,
Expand All @@ -77,7 +77,7 @@ func NewIndexer(
dependencies: dependencies,
printProgressDots: printProgressDots,
toolInfo: toolInfo,
w: protocol.NewWriter(w, excludeContent),
w: protocol.NewWriter(w, addContents),

// Empty maps
defsIndexed: map[string]bool{},
Expand Down
16 changes: 8 additions & 8 deletions protocol/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ import (
// Writer emits vertices and edges to the underlying writer. This struct
// will guarantee that unique identifiers are generated for each element.
type Writer struct {
w io.Writer
excludeContent bool
id int
numElements int
w io.Writer
addContents bool
id int
numElements int
}

// NewWriter creates a new Writer.
func NewWriter(w io.Writer, excludeContent bool) *Writer {
func NewWriter(w io.Writer, addContents bool) *Writer {
return &Writer{
w: w,
excludeContent: excludeContent,
w: w,
addContents: addContents,
}
}

Expand Down Expand Up @@ -61,7 +61,7 @@ func (w *Writer) EmitProject(languageID string) (string, error) {

func (w *Writer) EmitDocument(languageID, path string) (string, error) {
var contents []byte
if !w.excludeContent {
if w.addContents {
var err error
contents, err = ioutil.ReadFile(path)
if err != nil {
Expand Down

0 comments on commit 19196e0

Please sign in to comment.