Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Mastering Go
Mastering Go

Mastering Go: Create Golang production applications using network libraries, concurrency, machine learning, and advanced data structures , Second Edition

eBook
$35.99 $51.99
Paperback
$65.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

Mastering Go

Garbage collection

Garbage collection is the process of freeing up memory space that is not being used. In other words, the garbage collector sees which objects are out of scope and cannot be referenced anymore, and frees the memory space they consume. This process happens in a concurrent way while a Go program is running and not before or after the execution of the program. The documentation of the Go garbage collector implementation states the following:

"The GC runs concurrently with mutator threads, is type accurate (also known as precise), allows multiple GC threads to run in parallel. It is a concurrent mark and sweep that uses a write barrier. It is non-generational and non-compacting. Allocation is done using size segregated per P allocation areas to minimize fragmentation while eliminating locks in the common case."

There is lots of terminology here that will...

Calling C code from Go

Although Go intends to make your programming experience better and save you from the quirks of C, C remains a very capable programming language that is still useful. This means that there are situations, such as when using a database or a device driver written in C, that still require the use of C, which means that you will need to work with C code in your Go projects.

If you find yourself using this capability many times in the same project, you might need to reconsider your approach or your choice of programming language.

Calling C code from Go using the same file

The simplest way to call C code from a Go program is to include the C code in your Go source file. This needs special treatment but it is pretty...

Calling Go functions from C code

It is also possible to call a Go function from your C code. Therefore, this section will present you with a small example where two Go functions are going to be called from a C program. The Go package is going to be converted into a C shared library that is going to be used in the C program.

The Go package

This subsection will present you with the code of the Go package that will be used in a C program. The name of the Go package needs to be main but its filename can be anything you want; in this case, the filename will be usedByC.go and it will be presented in three parts.

You will learn more about Go packages in Chapter 6, What You Might Not Know About Go Packages and Go Functions.

The first part...

The defer keyword

The defer keyword postpones the execution of a function until the surrounding function returns, which is widely used in file input and output operations because it saves you from having to remember when to close an opened file. The defer keyword allows you to put the function call that closes an opened file near to the function call that opened it. As you will learn about the use of defer in file-related operations in Chapter 8, Telling a UNIX System What to Do, this section will present two different usages of defer. You will also see defer in action in the section that talks about the panic() and recover() built-in Go functions, as well as in the section that is related to logging.

It is very important to remember that deferred functions are executed in last in, first out (LIFO) order after the return of the surrounding function. Putting it simply, this means...

Panic and recover

This section will present you with a tricky technique that was first mentioned in the previous chapter. This technique involves the use of the panic() and recover() functions and will be presented in panicRecover.go, which you will see in three parts.

Strictly speaking, panic() is a built-in Go function that terminates the current flow of a Go program and starts panicking. On the other hand, the recover() function, which is also a built-in Go function, allows you to take back control of a goroutine that just panicked using panic().

The first part of the program is next:

package main 
 
import ( 
    "fmt" 
) 
 
func a() { 
    fmt.Println("Inside a()") 
    defer func() { 
        if c := recover(); c != nil { 
            fmt.Println("Recover inside a()!") 
        } 
    }() 
    fmt.Println("About to call b()") 
    b...

Two handy UNIX utilities

There are times when a UNIX program fails for some unknown reason or does not perform well and you want to find out why without having to rewrite your code and add a plethora of debugging statements.

This section will present two command-line utilities that allow you to see the C system calls executed by an executable file. The names of the two tools are strace(1) and dtrace(1) and they allow you to inspect the operation of a program.

Please remember that at the end of the day, all programs that work on UNIX machines end up using C system calls to communicate with the UNIX kernel and perform most of their tasks.

Although both tools can work with the go run command, you will get less unrelated output if you first create an executable file using go build and use this file. This mainly occurs because, as you already know, go run makes various temporary files...

Your Go environment

This section will talk about finding out information about your current Go environment using the functions and the properties of the runtime package. The name of the program that will be developed in this section is goEnv.go and it will be presented in two parts.

The first part of goEnv.go is next:

package main 
 
import ( 
    "fmt" 
    "runtime" 
) 

As you will see in a while, the runtime package contains functions and properties that will reveal the desired information. The second code portion of goEnv.go contains the implementation of the main() function:

func main() { 
    fmt.Print("You are using ", runtime.Compiler, " ") 
    fmt.Println("on a", runtime.GOARCH, "machine") 
    fmt.Println("Using Go version", runtime.Version()) 
    fmt.Println("Number of CPUs:", runtime.NumCPU...

The go env command

If you need to get a list of all environment variables supported by Go and the Go compiler, along with their current values, then the solution is to execute go env.

On my macOS Mojave, which uses Go version 1.11.4, the pretty rich output of go env is as follows:

$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/mtsouk/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/mtsouk/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.11.4/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.11.4/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2&quot...

The Go assembler

This section will briefly talk about the assembly language and the Go assembler, which is a Go tool that allows you to see the assembly language used by the Go compiler.

As an example, you can see the assembly language of the goEnv.go program you saw in the previous section of this chapter by executing the next command:

$ GOOS=darwin GOARCH=amd64 go tool compile -S goEnv.go
  

The value of the GOOS variable defines the name of the target operating system whereas the value of the GOARCH variable defines the compilation architecture. The preceding command was executed on a macOS Mojave machine, hence the use of the darwin value for the GOOS variable.

The output of the previous command is pretty large even for a small program such as goEnv.go. Some of its output is next:

"".main STEXT size=859 args=0x0 locals=0x118
   0x0000 00000 (goEnv.go:8)       TEXT...

Node trees

A Go node is a struct with a large number of properties. You will learn more about defining and using Go structures in Chapter 4, The Uses of Composite Types. Everything in a Go program is parsed and analyzed by the modules of the Go compiler according to the grammar of the Go programming language. The final product of this analysis is a tree that is specific to the provided Go code and represents the program in a different way that is suited to the compiler rather than to the developer.

Please note that go tool 6g -W test.go does not work on newer Go versions. You should use go tool compile -W test.go instead.

This section will first use the following Go code, which is saved as nodeTree.go, as an example in order to see the kind of low-level information the go tool can provide us with:

package main 
 
import ( 
    "fmt" 
) 
 
func main() { 
    fmt.Println...

Finding out more about go build

If you want to learn more about what is happening behind the scenes when you execute a go build command, you should add the -x flag to it:

$ go build -x defer.go
WORK=/var/folders/sk/ltk8cnw50lzdtr2hxcj5sv2m0000gn/T/go-build254573394
mkdir -p $WORK/b001/
cat >$WORK/b001/importcfg.link << 'EOF' # internal
packagefile command-line-arguments=/Users/mtsouk/Library/Caches/go-build/9d/9d6ca8651e083f3662adf82bb90a00837fc76f55839e65c7107bb55fcab92458-d
packagefile fmt=/usr/local/Cellar/go/1.11.4/libexec/pkg/darwin_amd64/fmt.a
packagefile runtime=/usr/local/Cellar/go/1.11.4/libexec/pkg/darwin_amd64/runtime.a
packagefile errors=/usr/local/Cellar/go/1.11.4/libexec/pkg/darwin_amd64/errors.a
packagefile io=/usr/local/Cellar/go/1.11.4/libexec/pkg/darwin_amd64/io.a
packagefile math=/usr/local/Cellar/go/1.11.4/libexec/pkg/darwin_amd64/math.a
packagefile...

Creating WebAssembly code

Go allows you to create WebAssembly code with the help of the go tool. Before I illustrate the process, I will share more information about WebAssembly.

A quick introduction to WebAssembly

WebAssembly (Wasm) is a machine model and executable format targeting a virtual machine. It is designed for efficiency, both in speed and file size. This means that you can use a WebAssembly binary on any platform you want without a single change.

WebAssembly comes in two formats: plain text format and binary format. Plain text format WebAssembly files have the .wat extension, whereas binary files have the .wasm file extension. Notice that once you have a WebAssembly binary file, you will have to load and use it using the...

General Go coding advice

The following is a list of practical advice that will help you to write better Go code:

  • If you have an error in a Go function, either log it or return it; do not do both unless you have a really good reason for doing so.
  • Go interfaces define behaviors not data and data structures.
  • Use the io.Reader and io.Writer interfaces when possible because they make your code more extensible.
  • Make sure that you pass a pointer to a variable to a function only when needed. The rest of the time, just pass the value of the variable.
  • Error variables are not string variables; they are error variables!
  • Do not test your Go code on production machines unless you have a really good reason to do so.
  • If you do not really know a Go feature, test it before using it for the first time, especially if you are developing an application or a utility that will be used by a large number...

Exercises and links

  • Learn more about the unsafe standard Go package by visiting its documentation page at https://golang.org/pkg/unsafe/.
  • Visit the web site of DTrace at http://dtrace.org/.
  • Use strace(1) on your Linux machine to inspect the operation of some standard UNIX utilities such as cp(1) and ls(1). What do you see?
  • If you are using a macOS machine, use dtruss(1) to see how the sync(8) utility works.
  • Write your own example where you use your own C code from a Go program.
  • Write a Go function and use it in a C program.
  • You can find more information about the functions of the runtime package by visiting https://golang.org/pkg/runtime/.
  • Reading research papers might be difficult but it is very rewarding. Please download the On-the-Fly Garbage Collection: An Exercise in Cooperation paper and read it. The paper can be found in many places, including https://dl.acm.org/citation...

Summary

This chapter discussed many interesting Go topics, including theoretical and practical information about the Go garbage collector; how to call C code from your Go programs; the handy and sometimes tricky defer keyword; the panic() and recover() functions; the strace(1), dtrace(1), and dtruss(1) UNIX tools; the use of the unsafe standard Go package; how to generate WebAssembly code from Go; and assembly code generated by Go. Finally, it shared information about your Go environment using the runtime package and showed how to reveal and explain the node tree of a Go program, before giving you some handy Go coding advice.

What you should remember from this chapter is that tools such as the unsafe Go package and the ability to call C code from Go are usually used on three occasions: firstly, when you want the best performance and you want to sacrifice some Go safety for it;...

Exercises and links

  • Learn more about the unsafe standard Go package by visiting its documentation page at https://golang.org/pkg/unsafe/.
  • Visit the web site of DTrace at http://dtrace.org/.
  • Use strace(1) on your Linux machine to inspect the operation of some standard UNIX utilities such as cp(1) and ls(1). What do you see?
  • If you are using a macOS machine, use dtruss(1) to see how the sync(8) utility works.
  • Write your own example where you use your own C code from a Go program.
  • Write a Go function and use it in a C program.
  • You can find more information about the functions of the runtime package by visiting https://golang.org/pkg/runtime/.
  • Reading research papers might be difficult but it is very rewarding. Please download the On-the-Fly Garbage Collection: An Exercise in Cooperation paper and read it. The paper can be found in many places, including https://dl.acm.org/citation...

Summary

This chapter discussed many interesting Go topics, including theoretical and practical information about the Go garbage collector; how to call C code from your Go programs; the handy and sometimes tricky defer keyword; the panic() and recover() functions; the strace(1), dtrace(1), and dtruss(1) UNIX tools; the use of the unsafe standard Go package; how to generate WebAssembly code from Go; and assembly code generated by Go. Finally, it shared information about your Go environment using the runtime package and showed how to reveal and explain the node tree of a Go program, before giving you some handy Go coding advice.

What you should remember from this chapter is that tools such as the unsafe Go package and the ability to call C code from Go are usually used on three occasions: firstly, when you want the best performance and you want to sacrifice some Go safety for it...

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Second edition of the bestselling guide to advanced Go programming, expanded to cover machine learning, more Go packages and a range of modern development techniques
  • Completes the Go developer’s education with real-world guides to building high-performance production systems
  • Packed with practical examples and patterns to apply to your own development work
  • Clearly explains Go nuances and features to remove the frustration from Go development

Description

Often referred to (incorrectly) as Golang, Go is the high-performance systems language of the future. Mastering Go, Second Edition helps you become a productive expert Go programmer, building and improving on the groundbreaking first edition. Mastering Go, Second Edition shows how to put Go to work on real production systems. For programmers who already know the Go language basics, this book provides examples, patterns, and clear explanations to help you deeply understand Go’s capabilities and apply them in your programming work. The book covers the nuances of Go, with in-depth guides on types and structures, packages, concurrency, network programming, compiler design, optimization, and more. Each chapter ends with exercises and resources to fully embed your new knowledge. This second edition includes a completely new chapter on machine learning in Go, guiding you from the foundation statistics techniques through simple regression and clustering to classification, neural networks, and anomaly detection. Other chapters are expanded to cover using Go with Docker and Kubernetes, Git, WebAssembly, JSON, and more. If you take the Go programming language seriously, the second edition of this book is an essential guide on expert techniques.

Who is this book for?

Mastering Go, Second Edition is for Go programmers who already know the language basics, and want to become expert Go practitioners.

What you will learn

  • Clear guidance on using Go for production systems
  • Detailed explanations of how Go internals work, the design choices behind the language, and how to optimize your Go code
  • A full guide to all Go data types, composite types, and data structures
  • Master packages, reflection, and interfaces for effective Go programming
  • Build high-performance systems networking code, including server and client-side applications
  • Interface with other systems using WebAssembly, JSON, and gRPC
  • Write reliable, high-performance concurrent code
  • Build machine learning systems in Go, from simple statistical regression to complex neural networks
Estimated delivery fee Deliver to Russia

Economy delivery 10 - 13 business days

$6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Aug 29, 2019
Length: 798 pages
Edition : 2nd
Language : English
ISBN-13 : 9781838559335
Category :
Languages :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Russia

Economy delivery 10 - 13 business days

$6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Publication date : Aug 29, 2019
Length: 798 pages
Edition : 2nd
Language : English
ISBN-13 : 9781838559335
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 153.97
Mastering Go
$65.99
The Go Workshop
$43.99
Go Programming Cookbook
$43.99
Total $ 153.97 Stars icon
Banner background image

Table of Contents

15 Chapters
Go and the Operating System Chevron down icon Chevron up icon
Understanding Go Internals Chevron down icon Chevron up icon
Working with Basic Go Data Types Chevron down icon Chevron up icon
The Uses of Composite Types Chevron down icon Chevron up icon
How to Enhance Go Code with Data Structures Chevron down icon Chevron up icon
What You Might Not Know About Go Packages and Functions Chevron down icon Chevron up icon
Reflection and Interfaces for All Seasons Chevron down icon Chevron up icon
Telling a UNIX System What to Do Chevron down icon Chevron up icon
Concurrency in Go – Goroutines, Channels, and Pipelines Chevron down icon Chevron up icon
Concurrency in Go – Advanced Topics Chevron down icon Chevron up icon
Code Testing, Optimization, and Profiling Chevron down icon Chevron up icon
The Foundations of Network Programming in Go Chevron down icon Chevron up icon
Network Programming – Building Your Own Servers and Clients Chevron down icon Chevron up icon
Machine Learning in Go Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.1
(33 Ratings)
5 star 60.6%
4 star 12.1%
3 star 9.1%
2 star 15.2%
1 star 3%
Filter icon Filter
Top Reviews

Filter reviews by




cd Dec 22, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I have just started reading Mastering Go, 2nd edition. The book contains many useful examples that can help someone learn Go and write Go code as well. What I find really handy is that it contains the required theory to understand the why of topics such Go data types, data structures, the Go Garbage Collector and the Go Scheduler.Overall, a great book.
Amazon Verified review Amazon
Vlad Bezden Nov 17, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Great book! It covers everything from how to start with Go to Machine Learning (ML) in Go. It has very good examples, with code and code output, so you don't have to write your code to see the result. Another good thing about this book that it covers Go version 1.13 and it has a chapter dedicated to Go modules and Go packages, which is very important. I read other books and usually, they don't cover this topic. Mihalis, cover this topic by going deeply starting with one package and then how to extend it to the module and how to pack, and deploy them. This book has two chapters on concurrency (Goroutines, channels, and pipelines), one chapter is to understand concurrency in Go and the second one is more advanced. At the end of each chapter, there is an "Exercises" chapter. Implementing those exercises you will learn much more about Go.I'm very strongly agreed that after you read this book you will become "master" in Go.
Amazon Verified review Amazon
No name Sep 19, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Based on the 1st edition but with more content. Still an excellent book that you can use as a reference and for learning Go.
Amazon Verified review Amazon
Kevin C Sep 20, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book is huge and covers a lot of topics! This book is primarily for developers who want to gain a greater understanding of the power of Go and how to do more cool things with the language.Pros:- Concepts are explained in a simple manner. For example, the author introduces a new concept or tool with Go and explains why you might want to use it and when.- Made me a better Go developer. This book has a lot of 1% tips that improve your Go knowledge.- Diverse range of topics that explained in depth.- Easy to follow along code samplesCons:- This is a huge book! So don't expect to read it in a week or two. However, read it more like a reference book for when you interested in learning how to use Go to build different projects.- The code examples are not formatted when you copy and paste into your IDE. However, this is a common issue with programming books. You can quickly fix this with the "go fmt" command.Overall: I really love this book and would recommend it! I expect to go back to this book as I code Go throughout this next year as a guided reference.Side note: I particularly enjoyed the UNIX and Concurrency chapters because I'm interested in building CLI tools and the power of Go as your backend programming language.
Amazon Verified review Amazon
Spiros Sep 17, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
If you want a really deep dive int Go internals and become a better Go Developer then that's the book for you. Lots of interesting topics and internals for Go and very good examples/code snippets to understand every little detail and advanced topics.I really enjoyed the sections about data structures, advanced concurrency, testing and optimization.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact [email protected] with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at [email protected] using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on [email protected] with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on [email protected] within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on [email protected] who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on [email protected] within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela