Skip to content
Source maps consumer for Golang
Branch: master
Clone or download
Pull request Compare This branch is even with go-sourcemap:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
internal/base64vlq
.travis.yml
LICENSE
Makefile
README.md
bench_test.go
consumer.go
consumer_test.go
example_test.go
mappings.go

README.md

Source maps consumer for Golang

Build Status

API docs: https://godoc.org/github.com/go-sourcemap/sourcemap. Examples: https://godoc.org/github.com/go-sourcemap/sourcemap#pkg-examples. Spec: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit.

Installation

Install:

go get -u github.com/go-sourcemap/sourcemap

Quickstart

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
}
You can’t perform that action at this time.