...
1 package sourcemap_test
2
3 import (
4 "fmt"
5 "io/ioutil"
6 "net/http"
7
8 "github.com/go-sourcemap/sourcemap"
9 )
10
11 func ExampleParse() {
12 mapURL := "http://code.jquery.com/jquery-2.0.3.min.map"
13 resp, err := http.Get(mapURL)
14 if err != nil {
15 panic(err)
16 }
17 defer resp.Body.Close()
18
19 b, err := ioutil.ReadAll(resp.Body)
20 if err != nil {
21 panic(err)
22 }
23
24 smap, err := sourcemap.Parse(mapURL, b)
25 if err != nil {
26 panic(err)
27 }
28
29 line, column := 5, 6789
30 file, fn, line, col, ok := smap.Source(line, column)
31 fmt.Println(file, fn, line, col, ok)
32
33 }
34
View as plain text