On Thu, Apr 16, 2015 at 6:00 PM, 'Matthew Dempsky' via golang-dev wrote:
Currently compress/flate has two copies of the Huffman decoder
initialization code, one for package flate and one for the (package main)
helper generator. I want to deduplicate that code by moving it into a
helper package compress/flate/internal/huffman.
What we do in golang.org/x/text/cases is:

cases.go has this line:
//go:generate go run gen.go gen_trieval.go

gen_trieval.go is "package main".

gen.go copies gen_trieval.go to trieval.go, substitutes s/main/cases/
and adds a "This file was generated by go generate; DO NOT EDIT"

Thus, there's one human-editable copy of the code (gen_trieval.go),
one generated copy of the code (trieval.go), and we are able to share
code between the package proper and its code generator, all in the one
directory and without an internal side package.

You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 4 of 5 | next ›
Discussion Overview
groupgolang-dev @
postedApr 16, '15 at 8:00a
activeApr 17, '15 at 12:02a



site design / logo © 2021 Grokbase