Version: v0.0.0-...-d84e329 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2017 License: LGPL-2.1


Liferay Go SDK

This repository contains a version of the Liferay Mobile SDK written in the Go language.

The Liferay Go SDK is an accurate port of the Android version and can be considered feature-complete. Nevertheless, it was created just for fun and basically as an experiment. Your mileage may vary.


To install the Liferay Go SDK, simply run:

go get

Alternatively, the source code of the SDK for Liferay 6.2 is available in the liferay folder. The tests folder contains the same unit tests of the Liferay Android SDK and can be a good help to understand how to use the SDK.

The SDK has been developed and tested with Go versions 1.3 and 1.4.


The source code of the SDK for Liferay 6.2 is already provided. This repository also contains the SDK builder, so you can easily generate a new SDK for a different version of Liferay or for your plugins:

go get
cd $GOPATH/src/
./gradlew generate

Have a look at this page to find the various configuration options available in


The Liferay Go SDK is an almost line-by-line port of the Android version, so more detailed information about usage can be found at this page.

  1. Create a Session with user credentials:

    import ""
    session := liferay.NewSession("http://localhost:8080", "", "test")


  2. Import the service package you need, for example:

    import ""


  3. Create a Service object and make a service call:

    service := blogsentry.NewService(session)
    entries, err := service.GetGroupEntries(10184, 0, 10)
    if err != nil {


    Go lacks support for method overloading (here's why), so overloaded service functions are renamed in GetGroupEntries2, GetGroupEntries3, etc.

    Compared to my other SDK, the Liferay Go SDK is a bit more rough in regards to return types, so some type assertions will be required in order to obtain the correct data types:

    for _, e := range entries {
    	e := e.(map[string]interface{})



The SDK allows sending requests using batch processing, which can be much more efficient in some cases. Read dlapp_test.go to find an example on how to create a batch of calls and send them all together.

Non-primitive arguments

There are some special cases in which service methods arguments are not primitives. In these cases, you should use ObjectWrapper. Read orderbycomparator_test.go and servicecontext_test.go to find examples on how to use non-primitive arguments in service methods.


Some Liferay services require argument types such as byte slices ([]byte) and Readers (io.Reader). Read dlapp_test.go to find an example on how to send binary data to the portal.


A huge huge huge thanks to Pier for the great logo!


This library, Liferay Go SDK, is free software ("Licensed Software"); you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; including but not limited to, the implied warranty of MERCHANTABILITY, NONINFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL