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