sourcemap.v1: gopkg.in/sourcemap.v1 Index | Examples | Files | Directories

package sourcemap

import "gopkg.in/sourcemap.v1"

Index

Examples

Package Files

consumer.go sourcemap.go

type Consumer Uses

type Consumer struct {
    // contains filtered or unexported fields
}

func Parse Uses

func Parse(mapURL string, b []byte) (*Consumer, error)

Code:

mapURL := "http://code.jquery.com/jquery-2.0.3.min.map"
resp, err := http.Get(mapURL)
if err != nil {
    panic(err)
}
defer resp.Body.Close()

b, err := ioutil.ReadAll(resp.Body)
if err != nil {
    panic(err)
}

smap, err := sourcemap.Parse(mapURL, b)
if err != nil {
    panic(err)
}

line, column := 5, 6789
file, fn, line, col, ok := smap.Source(line, column)
fmt.Println(file, fn, line, col, ok)

Output:

http://code.jquery.com/jquery-2.0.3.js apply 4360 27 true

func (*Consumer) File Uses

func (c *Consumer) File() string

func (*Consumer) Source Uses

func (c *Consumer) Source(genLine, genCol int) (source, name string, line, col int, ok bool)

Directories

PathSynopsis
base64vlq

Package sourcemap imports 9 packages (graph) and is imported by 36 packages. Updated 2018-02-24. Refresh now. Tools for package owners.