mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-08 02:31:19 +00:00
da20785685
Former-commit-id: 23f542f43b4b493e38f5aa4c29788ed93a63b43b [formerly 71b23a6a28eb045fcfeab6329de69f1e5455486b] Former-commit-id: d12b3a6decc876f010a71f98e11df7387c1aaf2a
36 lines
749 B
Markdown
36 lines
749 B
Markdown
# Source Maps consumer for Golang [![Build Status](https://travis-ci.org/go-sourcemap/sourcemap.svg?branch=v1)](https://travis-ci.org/go-sourcemap/sourcemap)
|
|
|
|
## Installation
|
|
|
|
Install:
|
|
|
|
go get gopkg.in/sourcemap.v1
|
|
|
|
## Quickstart
|
|
|
|
```go
|
|
func ExampleParse() {
|
|
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
|
|
}
|
|
```
|