Skip to content

basic example on windows messes up import path in generated file #156

@SunnysideAaron

Description

@SunnysideAaron

I'm on windows. Working through the basic examples readme. There appears to be a problem with generating paths in the code on windows.

$Env:GOPATH

returns

C:\Users\fuzzy\go

I run the following commands

cd c:\Working\goexamples
gonew goa.design/examples/basic@latest
cd basic
goa gen goa.design/examples/basic/design -o $GOPATH/src/goa.design/examples/basic

I am then getting the following error

exit status 1
C:\src\goa.design\examples\basic\gen\calc\service.go:15:16: unknown escape sequence
C:\src\goa.design\examples\basic\gen\calc\service.go:15:20: unknown escape sequence
C:\src\goa.design\examples\basic\gen\calc\service.go:15:31: unknown escape sequence
C:\src\goa.design\examples\basic\gen\calc\service.go:15:46: unknown escape sequence

========
Content:
// Code generated by goa v3.19.1, DO NOT EDIT.
//
// calc service
//
// Command:
// $ goa gen goa.design/examples/basic/design -o /src/goa.design/examples/basic

package calc

import (
        "context"
        "io"
        goa "goa.design/goa/v3/pkg"
        "goa.design/goa/v3/security"
        calcviews "C:\src\goa.design\examples\basic\gen/calc/views"
)


// The calc service performs operations on numbers
type Service interface {
        // Multiply implements multiply.
                Multiply(context.Context, *MultiplyPayload) (res int, err error)
}

// APIName is the name of the API as defined in the design.
const APIName = "calc"

// APIVersion is the version of the API as defined in the design.
const APIVersion = "0.0.1"

// ServiceName is the name of the service as defined in the design. This is the
// same value that is set in the endpoint request contexts under the ServiceKey
// key.
const ServiceName = "calc"

// MethodNames lists the service method names as defined in the design. These
// are the same values that are set in the endpoint request contexts under the
// MethodKey key.
var MethodNames = [1]string{ "multiply",  }
// MultiplyPayload is the payload type of the calc service multiply method.
type MultiplyPayload struct {
        // Left operand
        A int
        // Right operand
        B int
}

Notice the last line of the import()

calcviews "C:\src\goa.design\examples\basic\gen/calc/views"

notice the slashes are mixed \ and /
also c:\ is not my gopath

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions