• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

internal/base64vlq/H19-Jan-2018-

.travis.ymlH A D19-Jan-2018109

LICENSEH A D19-Jan-20181.3 KiB

MakefileH A D19-Jan-201856

README.mdH A D19-Jan-2018996

bench_test.goH A D19-Jan-2018498

consumer.goH A D19-Jan-20184.5 KiB

consumer_test.goH A D19-Jan-20187 KiB

example_test.goH A D19-Jan-2018610

mappings.goH A D19-Jan-20182.7 KiB

README.md

1# Source maps consumer for Golang
2
3[![Build Status](https://travis-ci.org/go-sourcemap/sourcemap.svg)](https://travis-ci.org/go-sourcemap/sourcemap)
4
5API docs: https://godoc.org/github.com/go-sourcemap/sourcemap.
6Examples: https://godoc.org/github.com/go-sourcemap/sourcemap#pkg-examples.
7Spec: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit.
8
9## Installation
10
11Install:
12
13```shell
14go get -u github.com/go-sourcemap/sourcemap
15```
16
17## Quickstart
18
19```go
20func ExampleParse() {
21	mapURL := "http://code.jquery.com/jquery-2.0.3.min.map"
22	resp, err := http.Get(mapURL)
23	if err != nil {
24		panic(err)
25	}
26	defer resp.Body.Close()
27
28	b, err := ioutil.ReadAll(resp.Body)
29	if err != nil {
30		panic(err)
31	}
32
33	smap, err := sourcemap.Parse(mapURL, b)
34	if err != nil {
35		panic(err)
36	}
37
38	line, column := 5, 6789
39	file, fn, line, col, ok := smap.Source(line, column)
40	fmt.Println(file, fn, line, col, ok)
41	// Output: http://code.jquery.com/jquery-2.0.3.js apply 4360 27 true
42}
43```
44