Skip to content

Commit

Permalink
Fix gen.go, formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebakken committed Oct 2, 2023
1 parent ceadd2f commit 607b817
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 13 deletions.
14 changes: 14 additions & 0 deletions gen.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
$DebugPreference = 'Continue'
$ErrorActionPreference = 'Stop'

Set-PSDebug -Off
Set-StrictMode -Version 'Latest' -ErrorAction 'Stop' -Verbose

New-Variable -Name curdir -Option Constant -Value $PSScriptRoot

$specDir = Resolve-Path -LiteralPath (Join-Path -Path $curdir -ChildPath 'spec')
$amqpSpecXml = Resolve-Path -LiteralPath (Join-Path -Path $specDir -ChildPath 'amqp0-9-1.stripped.extended.xml')
$gen = Resolve-Path -LiteralPath (Join-Path -Path $specDir -ChildPath 'gen.go')
$spec091 = Resolve-Path -LiteralPath (Join-Path -Path $curdir -ChildPath 'spec091.go')

Get-Content -LiteralPath $amqpSpecXml | go run $gen | gofmt | Set-Content -Force -Path $spec091
27 changes: 14 additions & 13 deletions spec/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ import (
"fmt"
"io"
"log"
"os"
"regexp"
"strings"
"text/template"
)

var (
ErrUnknownType = errors.New("Unknown field type in gen")
ErrUnknownDomain = errors.New("Unknown domain type in gen")
ErrUnknownType = errors.New("unknown field type in gen")
ErrUnknownDomain = errors.New("unknown domain type in gen")
)

var amqpTypeToNative = map[string]string{
Expand Down Expand Up @@ -147,17 +148,17 @@ var (
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/* GENERATED FILE - DO NOT EDIT */
/* Rebuild from the spec/gen.go tool */
/* GENERATED FILE - DO NOT EDIT */
/* Rebuild from the spec/gen.go tool */
{{with .Root}}
package amqp091
{{with .Root}}
package amqp091
import (
"fmt"
"encoding/binary"
"io"
)
import (
"fmt"
"encoding/binary"
"io"
)
// Error codes that can be sent from the server during a connection or
// channel exception or used by the client to indicate a class of error like
Expand Down Expand Up @@ -241,7 +242,7 @@ var (
switch mf.MethodId {
{{range .Methods}}
case {{.Index}}: // {{$class.Name}} {{.Name}}
//fmt.Println("NextMethod: class:{{$class.Index}} method:{{.Index}}")
// fmt.Println("NextMethod: class:{{$class.Index}} method:{{.Index}}")
method := &{{$.StructName $class.Name .Name}}{}
if err = method.read(r.r); err != nil {
return
Expand Down Expand Up @@ -434,7 +435,7 @@ func (renderer *renderer) Domain(field Field) (domain Domain, err error) {
}
}
return domain, nil
//return domain, ErrUnknownDomain
// return domain, ErrUnknownDomain
}

func (renderer *renderer) FieldName(field Field) (t string) {
Expand Down

0 comments on commit 607b817

Please sign in to comment.