Rakefile (455B)
1 require "erb" 2 3 rule '.go' => '.go.erb' do |task| 4 erb = ERB.new(File.read(task.source)) 5 File.write(task.name, "// Do not edit. Generated from #{task.source}\n" + erb.result(binding)) 6 sh "goimports", "-w", task.name 7 end 8 9 generated_code_files = [ 10 "pgtype/int.go", 11 "pgtype/int_test.go", 12 "pgtype/integration_benchmark_test.go", 13 "pgtype/zeronull/int.go", 14 "pgtype/zeronull/int_test.go" 15 ] 16 17 desc "Generate code" 18 task generate: generated_code_files