Replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...)
diff --git a/core/log_test.go b/core/log_test.go
index 8c4a449..e2246f0 100644
--- a/core/log_test.go
+++ b/core/log_test.go
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
 package rocketmq
 
 import (
diff --git a/core/producer.go b/core/producer.go
index f66b985..f402589 100644
--- a/core/producer.go
+++ b/core/producer.go
@@ -90,8 +90,7 @@
 		code = int(C.SetProducerNameServerAddress(cproduer, cs))
 		C.free(unsafe.Pointer(cs))
 		if code != 0 {
-			return nil, errors.New(fmt.Sprintf("Producer Set NameServerAddress error, code is: %d"+
-				"please check cpp logs for details", code))
+			return nil, fmt.Errorf("producer Set NameServerAddress error, code is: %d", code)
 		}
 	}
 
@@ -100,8 +99,7 @@
 		code = int(C.SetProducerNameServerDomain(cproduer, cs))
 		C.free(unsafe.Pointer(cs))
 		if code != 0 {
-			return nil, errors.New(fmt.Sprintf("Producer Set NameServerDomain error, code is: %d"+
-				"please check cpp logs for details", code))
+			return nil, fmt.Errorf("producer Set NameServerDomain error, code is: %d", code)
 		}
 	}
 
@@ -110,8 +108,7 @@
 		code = int(C.SetProducerInstanceName(cproduer, cs))
 		C.free(unsafe.Pointer(cs))
 		if code != 0 {
-			return nil, errors.New(fmt.Sprintf("Producer Set InstanceName error, code is: %d"+
-				"please check cpp logs for details", code))
+			return nil, fmt.Errorf("producer Set InstanceName error, code is: %d", code)
 		}
 	}
 
@@ -125,7 +122,7 @@
 		C.free(unsafe.Pointer(sk))
 		C.free(unsafe.Pointer(ch))
 		if code != 0 {
-			return nil, errors.New(fmt.Sprintf("Producer Set Credentials error, code is: %d", code))
+			return nil, fmt.Errorf("producer Set Credentials error, code is: %d", code)
 		}
 	}
 
@@ -134,38 +131,38 @@
 		code = int(C.SetProducerLogPath(cproduer, cs))
 		C.free(unsafe.Pointer(cs))
 		if code != 0 {
-			return nil, errors.New(fmt.Sprintf("Producer Set LogPath error, code is: %d", code))
+			return nil, fmt.Errorf("producer Set LogPath error, code is: %d", code)
 		}
 
 		code = int(C.SetProducerLogFileNumAndSize(cproduer, C.int(config.LogC.FileNum), C.long(config.LogC.FileSize)))
 		if code != 0 {
-			return nil, errors.New(fmt.Sprintf("Producer Set FileNumAndSize error, code is: %d", code))
+			return nil, fmt.Errorf("producer Set FileNumAndSize error, code is: %d", code)
 		}
 
 		code = int(C.SetProducerLogLevel(cproduer, C.CLogLevel(config.LogC.Level)))
 		if code != 0 {
-			return nil, errors.New(fmt.Sprintf("Producer Set LogLevel error, code is: %d", code))
+			return nil, fmt.Errorf("producer Set LogLevel error, code is: %d", code)
 		}
 	}
 
 	if config.SendMsgTimeout > 0 {
 		code = int(C.SetProducerSendMsgTimeout(cproduer, C.int(config.SendMsgTimeout)))
 		if code != 0 {
-			return nil, errors.New(fmt.Sprintf("Producer Set SendMsgTimeout error, code is: %d", code))
+			return nil, fmt.Errorf("producer Set SendMsgTimeout error, code is: %d", code)
 		}
 	}
 
 	if config.CompressLevel > 0 {
 		code = int(C.SetProducerCompressLevel(cproduer, C.int(config.CompressLevel)))
 		if code != 0 {
-			return nil, errors.New(fmt.Sprintf("Producer Set CompressLevel error, code is: %d", code))
+			return nil, fmt.Errorf("producer Set CompressLevel error, code is: %d", code)
 		}
 	}
 
 	if config.MaxMessageSize > 0 {
 		code = int(C.SetProducerMaxMessageSize(cproduer, C.int(config.MaxMessageSize)))
 		if code != 0 {
-			return nil, errors.New(fmt.Sprintf("Producer Set MaxMessageSize error, code is: %d", code))
+			return nil, fmt.Errorf("producer Set MaxMessageSize error, code is: %d", code)
 		}
 	}
 
@@ -186,7 +183,7 @@
 func (p *defaultProducer) Start() error {
 	code := int(C.StartProducer(p.cproduer))
 	if code != 0 {
-		return errors.New(fmt.Sprintf("start producer error, error code is: %d", code))
+		return fmt.Errorf("start producer error, error code is: %d", code)
 	}
 	return nil
 }
diff --git a/core/push_consumer.go b/core/push_consumer.go
index ef1923c..c39dc09 100644
--- a/core/push_consumer.go
+++ b/core/push_consumer.go
@@ -98,7 +98,7 @@
 		code = int(C.SetPushConsumerNameServerAddress(cconsumer, cs))
 		C.free(unsafe.Pointer(cs))
 		if code != 0 {
-			return nil, errors.New(fmt.Sprintf(fmt.Sprintf("PushConsumer Set NameServerAddress error, code is: %d", code)))
+			return nil, fmt.Errorf("PushConsumer Set NameServerAddress error, code is: %d", code)
 		}
 	}
 
@@ -107,7 +107,7 @@
 		code = int(C.SetPushConsumerNameServerDomain(cconsumer, cs))
 		C.free(unsafe.Pointer(cs))
 		if code != 0 {
-			return nil, errors.New(fmt.Sprintf("PushConsumer Set NameServerDomain error, code is: %d", code))
+			return nil, fmt.Errorf("PushConsumer Set NameServerDomain error, code is: %d", code)
 		}
 	}
 
@@ -116,8 +116,8 @@
 		code = int(C.SetPushConsumerInstanceName(cconsumer, cs))
 		C.free(unsafe.Pointer(cs))
 		if code != 0 {
-			return nil, errors.New(fmt.Sprintf("PushConsumer Set InstanceName error, code is: %d, "+
-				"please check cpp logs for details", code))
+			return nil, fmt.Errorf("PushConsumer Set InstanceName error, code is: %d, "+
+				"please check cpp logs for details", code)
 		}
 	}
 
@@ -130,7 +130,7 @@
 		C.free(unsafe.Pointer(sk))
 		C.free(unsafe.Pointer(ch))
 		if code != 0 {
-			return nil, errors.New(fmt.Sprintf("PushConsumer Set Credentials error, code is: %d", int(code)))
+			return nil, fmt.Errorf("PushConsumer Set Credentials error, code is: %d", int(code))
 		}
 	}
 
@@ -139,31 +139,31 @@
 		code = int(C.SetPushConsumerLogPath(cconsumer, cs))
 		C.free(unsafe.Pointer(cs))
 		if code != 0 {
-			return nil, errors.New(fmt.Sprintf("PushConsumer Set LogPath error, code is: %d", code))
+			return nil, fmt.Errorf("PushConsumer Set LogPath error, code is: %d", code)
 		}
 
 		code = int(C.SetPushConsumerLogFileNumAndSize(cconsumer, C.int(config.LogC.FileNum), C.long(config.LogC.FileSize)))
 		if code != 0 {
-			return nil, errors.New(fmt.Sprintf("PushConsumer Set FileNumAndSize error, code is: %d", code))
+			return nil, fmt.Errorf("PushConsumer Set FileNumAndSize error, code is: %d", code)
 		}
 
 		code = int(C.SetPushConsumerLogLevel(cconsumer, C.CLogLevel(config.LogC.Level)))
 		if code != 0 {
-			return nil, errors.New(fmt.Sprintf("PushConsumer Set LogLevel error, code is: %d", code))
+			return nil, fmt.Errorf("PushConsumer Set LogLevel error, code is: %d", code)
 		}
 	}
 
 	if config.ThreadCount > 0 {
 		code = int(C.SetPushConsumerThreadCount(cconsumer, C.int(config.ThreadCount)))
 		if code != 0 {
-			return nil, errors.New(fmt.Sprintf("PushConsumer Set ThreadCount error, code is: %d", int(code)))
+			return nil, fmt.Errorf("PushConsumer Set ThreadCount error, code is: %d", int(code))
 		}
 	}
 
 	if config.MessageBatchMaxSize > 0 {
 		code = int(C.SetPushConsumerMessageBatchMaxSize(cconsumer, C.int(config.MessageBatchMaxSize)))
 		if code != 0 {
-			return nil, errors.New(fmt.Sprintf("PushConsumer Set MessageBatchMaxSize error, code is: %d", int(code)))
+			return nil, fmt.Errorf("PushConsumer Set MessageBatchMaxSize error, code is: %d", int(code))
 		}
 	}
 
@@ -178,7 +178,7 @@
 		code = int(C.SetPushConsumerMessageModel(cconsumer, mode))
 
 		if code != 0 {
-			return nil, errors.New(fmt.Sprintf("PushConsumer Set ConsumerMessageModel error, code is: %d", int(code)))
+			return nil, fmt.Errorf("PushConsumer Set ConsumerMessageModel error, code is: %d", int(code))
 		}
 
 	}
@@ -186,7 +186,7 @@
 	code = int(C.RegisterMessageCallback(cconsumer, (C.MessageCallBack)(unsafe.Pointer(C.callback_cgo))))
 
 	if code != 0 {
-		return nil, errors.New(fmt.Sprintf("PushConsumer RegisterMessageCallback error, code is: %d", int(code)))
+		return nil, fmt.Errorf("PushConsumer RegisterMessageCallback error, code is: %d", int(code))
 	}
 
 	consumer.cconsumer = cconsumer
@@ -197,7 +197,7 @@
 func (c *defaultPushConsumer) Start() error {
 	code := C.StartPushConsumer(c.cconsumer)
 	if code != 0 {
-		return errors.New(fmt.Sprintf("start PushConsumer error, code is: %d", int(code)))
+		return fmt.Errorf("start PushConsumer error, code is: %d", int(code))
 	}
 	return nil
 }
@@ -223,7 +223,7 @@
 	}
 	code := C.Subscribe(c.cconsumer, C.CString(topic), C.CString(expression))
 	if code != 0 {
-		return errors.New(fmt.Sprintf("subscribe topic: %s failed, error code is: %d", topic, int(code)))
+		return fmt.Errorf("subscribe topic: %s failed, error code is: %d", topic, int(code))
 	}
 	c.funcsMap.Store(topic, consumeFunc)
 	log.Infof("subscribe topic[%s] with expression[%s] successfully.", topic, expression)
diff --git a/core/queue_selector.go b/core/queue_selector.go
index 311c378..7bf1927 100644
--- a/core/queue_selector.go
+++ b/core/queue_selector.go
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
 package rocketmq
 
 import "C"
diff --git a/core/queue_selector_test.go b/core/queue_selector_test.go
index e9a68ee..74fff80 100644
--- a/core/queue_selector_test.go
+++ b/core/queue_selector_test.go
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
 package rocketmq
 
 import (
diff --git a/core/utils.go b/core/utils.go
index 71bde6c..e9f83f1 100644
--- a/core/utils.go
+++ b/core/utils.go
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
 package rocketmq
 
 import "fmt"
diff --git a/examples/orderproducer/producer.go b/examples/orderproducer/producer.go
index 5559d87..f3d70c7 100644
--- a/examples/orderproducer/producer.go
+++ b/examples/orderproducer/producer.go
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
 package main
 
 import (