Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/mobile: generated objective-C header protocols doesn't contain code comments #46956

Open
SpaWn2KiLl opened this issue Jun 28, 2021 · 0 comments · May be fixed by golang/mobile#67
Open

x/mobile: generated objective-C header protocols doesn't contain code comments #46956

SpaWn2KiLl opened this issue Jun 28, 2021 · 0 comments · May be fixed by golang/mobile#67

Comments

@SpaWn2KiLl
Copy link

@SpaWn2KiLl SpaWn2KiLl commented Jun 28, 2021

What version of Go are you using (go version)?

$ go version
go version go1.16 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/itsector/Library/Caches/go-build"
GOENV="/Users/itsector/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/itsector/go/pkg/mod"
GOOS="darwin"
GOPATH="/Users/itsector/go"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/spawn2kill/sdk/go1.16"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/spawn2kill/sdk/go1.16/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.16"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/zw/k3cy323s26zcn5tdrvqy0p2r0000gp/T/go-build3668600279=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I have a small library that I want to export to Swift which exports an interface that should be implemented in Swift code. The generated Objective-C header file doesn't contain the code comments on the @protocol declaration but it does on the @interface class declaration that implements the exported interface.

A simple Golang code sample:

package code_test

// ImplementMeInSwift exposed interface.
type ImplementMeInSwift interface {
	// ImplementThisMethod this method should be implemented in Swift code
	ImplementThisMethod(str string)
}

What did you expect to see?

// Objective-C API for talking to code_test Go package.
//   gobind -lang=objc code_test
//
// File is generated by gobind. Do not edit.

#ifndef __Code_test_H__
#define __Code_test_H__

@import Foundation;
#include "ref.h"
#include "Universe.objc.h"


@protocol Code_testImplementMeInSwift;
@class Code_testImplementMeInSwift;

@protocol Code_testImplementMeInSwift <NSObject>
/**
 * ImplementThisMethod this method should be implemented in Swift code
 */
- (void)implementThisMethod:(NSString* _Nullable)str;
@end

@class Code_testImplementMeInSwift;

/**
 * ImplementMeInSwift exposed interface.
 */
@interface Code_testImplementMeInSwift : NSObject <goSeqRefInterface, Code_testImplementMeInSwift> {
}
@property(strong, readonly) _Nonnull id _ref;

- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
/**
 * ImplementThisMethod this method should be implemented in Swift code
 */
- (void)implementThisMethod:(NSString* _Nullable)str;
@end

#endif

What did you see instead?

// Objective-C API for talking to code_test Go package.
//   gobind -lang=objc code_test
//
// File is generated by gobind. Do not edit.

#ifndef __Code_test_H__
#define __Code_test_H__

@import Foundation;
#include "ref.h"
#include "Universe.objc.h"


@protocol Code_testImplementMeInSwift;
@class Code_testImplementMeInSwift;

@protocol Code_testImplementMeInSwift <NSObject>
- (void)implementThisMethod:(NSString* _Nullable)str;
@end

@class Code_testImplementMeInSwift;

/**
 * ImplementMeInSwift exposed interface.
 */
@interface Code_testImplementMeInSwift : NSObject <goSeqRefInterface, Code_testImplementMeInSwift> {
}
@property(strong, readonly) _Nonnull id _ref;

- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
/**
 * ImplementThisMethod this method should be implemented in Swift code
 */
- (void)implementThisMethod:(NSString* _Nullable)str;
@end

#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants