src-d / proteus

Generate .proto files from Go source code.
https://blog.sourced.tech/post/proteus/
MIT License
735 stars 70 forks source link

type ... will be ignored because it was not present on the scan path. #101

Open ilejn opened 6 years ago

ilejn commented 6 years ago

proteus handles []byte,

>proteus  proto -f /tmp/proteus -p ufdata/tst --verbose
INFO: Generated proto: /tmp/proteus/ufdata/tst/generated.proto

>cat ./main.go 
package main

// Exported smth
//proteus:generate
type Exported struct {
    Field string
    SrcIP []byte `json:"src_ip"`
}

while does not handle net.IP which is effectively the same producing type "IP" of package net will be ignored because it was not present on the scan path.

>proteus  proto -f /tmp/proteus -p ufdata/tst --verbose
WARN: type "IP" of package net will be ignored because it was not present on the scan path.
INFO: Generated proto: /tmp/proteus/ufdata/tst/generated.proto
>cat ./main.go 
package main

import "net"

// Exported smth
//proteus:generate
type Exported struct {
    Field string
    SrcIP net.IP `json:"src_ip"`
}

I can see in strace that proteus reads net/ip.go source file, while it does not help. Is there any way to use such types?