Skip to content

Commit 611b22c

Browse files
committed
make creation of source maps optional with a flag
1 parent 89e2069 commit 611b22c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tool.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func init() {
6767

6868
func main() {
6969
var (
70-
options = &gbuild.Options{CreateMapFile: true}
70+
options = &gbuild.Options{}
7171
pkgObj string
7272
tags string
7373
)
@@ -83,6 +83,7 @@ func main() {
8383
compilerFlags.StringVar(&tags, "tags", "", "a list of build tags to consider satisfied during the build")
8484
compilerFlags.BoolVar(&options.MapToLocalDisk, "localmap", false, "use local paths for sourcemap")
8585
compilerFlags.BoolVarP(&options.NoCache, "no_cache", "a", false, "rebuild all packages from scratch")
86+
compilerFlags.BoolVarP(&options.CreateMapFile, "source_map", "s", true, "disable generation of source maps")
8687

8788
flagWatch := pflag.NewFlagSet("", 0)
8889
flagWatch.BoolVarP(&options.Watch, "watch", "w", false, "watch for changes to the source files")
@@ -507,7 +508,7 @@ func main() {
507508
}
508509

509510
// Create a new session eagerly to check if it fails, and report the error right away.
510-
// Otherwise users will see it only after trying to serve a package, which is a bad experience.
511+
// Otherwise, users will see it only after trying to serve a package, which is a bad experience.
511512
_, err := gbuild.NewSession(options)
512513
if err != nil {
513514
return err
@@ -725,7 +726,7 @@ func (fs serveCommandFileSystem) serveSourceTree(xctx gbuild.XContext, reqPath s
725726
// directories, which no longer align with import paths.
726727
//
727728
// We don't know which part of the requested path is package import path and
728-
// which is a path under the package directory, so we try different slipt
729+
// which is a path under the package directory, so we try different split
729730
// points until the package is found successfully.
730731
for i := len(parts); i > 0; i-- {
731732
pkgPath := path.Clean(path.Join(parts[:i]...))

0 commit comments

Comments
 (0)