Goa v3.6.0

Announcing Goa v3.6.0

Go v3.6.0 is out! There were many bug fixes made in the past 6 months (since 3.5.0), see the complete list on GitHub. v3.6.0 also brings many new features and improvements.

New Features

Multi-Server Mounting

The newly generated Use function on the generated HTTP server structs makes it possible to mount multiple servers at the same time on the same underlying muxer (PR 2974).

// Doing
s := goahttp.Server{s1, s2, s3}
s.Use(httpmiddleware.RequestID())
s.Mount(mux)

// Instead of
s := goahttp.Server{s1, s2, s3}
s.Use(httpmiddleware.RequestID())

server1.Mount(mux, s1)
server2.Mount(mux, s2)
server3.Mount(mux, s3)

Contributor: Ernesto Jiménez

Custom Go Package Path for User Types

The new struct:pkg:path Meta tag makes it possible to specify the Go package path for the service level Go structs generated by user types (PR 3011).

package design

var MyType = Type("MyType", func() {
    Attribute("name")
    Meta("struct:pkg:path", "types") // generates gen/types/my_type.go
})

In particular this makes it possible to generate structs from multiple services in the same package so that for example the same HTTP middleware may be applied to multiple services:

package design

var MyType = Type("MyType", func() {
    Attribute("name")
    Meta("struct:pkg:path", "types") // generates gen/types/my_type.go
})

var _ = Service("service1", func() {
    Method("method1", func() {
        Payload(MyType) // uses gen/types/my_type.go
    })
})

var _ = Service("service2", func() {
    Method("method2", func() {
        Payload(MyType) // uses gen/types/my_type.go
    })
})

Contributor: Raphael Simon

Improvements

Better Error Handling

The ServiceError struct now includes a Field field which can be used to specify or lookup the field that caused a validation error (PR 2902).
Contributor: Lawrence Jones

The handling of gRPC server errors is also improved with new DSL that makes it possible for designs to generate errors consistent with the errors automatically generated by Goa (PR 2952).
Contributor: Nitin Mohan

Better OpenAPI Specification

The OpenAPI specification generated for Map types now has more specific descriptions for the key and element types (PR 2941).
Contributor: Taichi Sasaki

Miscellaneous

The HTTP response capture middleware now supports the Flusher and Pusher interfaces (PR 2976).
Contributor: Raphael Simon

Goa now supports vendoring at the project level (PR 2979).
Contributor: Dave Greene

The default Goa encoders now set the Content-Type header in HTTP responses (PR 2982).
Contributor: @antichris

The generated response encoding code now supports wrapped errors (PR 3005).
Contributor: Raphael Simon

Plugins

The new Types Plugin makes it possible to generate Go structs for user types outside of service definitions (PR 120).
Contributor: Raphael Simon

There were also many improvements made to the CORS plugin (PR 111).
Contributor: Ernesto Jiménez

The Goakit plugin now generates better service names (PR 117).
Contributor: @antichris

Documentation

On top of the code improvements above, there is also new documentation explaining how to implement a Goa service without using goa example with translations into Japanese and Italian.
Contributors: Raphael Simon, Taichi Sasaki, @ikawaha and Alessandro Sanino.

The Files DSL is now better documented (PR 2962).
Contributor: @kmacmcfarlane

Sponsors

Also new is the ability to sponsor the Goa project! he funds collected through this sponsorship help run the backend infrastructure needed to support the website and the Go package repositories hosted at https://goa.design. Any surplus goes towards efforts to build the community.

Going Forward

Thank you to all the contributors and users who helped improve Goa in the past 6 months. As you can see there were many improvements and I can’t wait to see what the next 6 months will bring!