Skip to content

x/mobile: circular dependencies between interfaces won't build on ios targets #74025

Open
@benbenbenbenbenben

Description

@benbenbenbenbenben

We had a particular case where Objective-C would have needed a forward declaration when building the following Go snippets as Objective-C:

type BuilderOptionContext interface {
	// public API
        // (omitted for brevity)
	// private API
	getOptions() *[]BuilderOption
}

type BuilderOption interface {
	Option() BuilderOptionType
	Apply(builder BuilderOptionContext) error
}

It was easier enough to work around but there was no indication from gomobile what the problem was. The native build failed reporting a type was expected at line/column but no more detail than that. It was only after I commented out the cleanup in cmd/gomobile/bind/go that I could see the generated source and work out what was happening... perhaps we're missing a flag to prevent cleanup on failure?

Granted this was a code smell and we don't put any private API on that public interface now, but it was interesting nevertheless.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugReportIssues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.mobileAndroid, iOS, and x/mobile

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions